Changeset 218 in code for trunk/service.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/service.go

    r202 r218  
    2020        handle   func(dc *downstreamConn, params []string) error
    2121        children serviceCommandSet
     22}
     23
     24func sendServiceNOTICE(dc *downstreamConn, text string) {
     25        dc.SendMessage(&irc.Message{
     26                Prefix:  &irc.Prefix{Name: serviceNick},
     27                Command: "NOTICE",
     28                Params:  []string{dc.nick, text},
     29        })
    2230}
    2331
Note: See TracChangeset for help on using the changeset viewer.