Changeset 218 in code for trunk/upstream.go


Ignore:
Timestamp:
Apr 4, 2020, 3:33:09 PM (5 years ago)
Author:
delthas
Message:

Send one NOTICE on new upstream disconnect/connect errors

In order to notify the user when we are disconnected from a network
(either due to an error, or due a QUIT), and when we fail reconnecting,
this commit adds support for sending a short NOTICE message from the
service user to all relevant downstreams.

The last error is stored, and cleared on successful connection, to
ensure that the user is *not* flooded with identical connection error
messages, which can often happen when a server is down.

No lock is needed on lastError because it is only read and modified from
the user goroutine.

Closes: https://todo.sr.ht/~emersion/soju/27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r217 r218  
    104104
    105105func (uc *upstreamConn) forEachDownstream(f func(*downstreamConn)) {
    106         uc.user.forEachDownstream(func(dc *downstreamConn) {
    107                 if dc.network != nil && dc.network != uc.network {
    108                         return
    109                 }
    110                 f(dc)
    111         })
     106        uc.network.forEachDownstream(f)
    112107}
    113108
Note: See TracChangeset for help on using the changeset viewer.