serverside pings
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
818bee77dd
commit
a25c3bcf4c
@ -98,13 +98,19 @@ func (s *Server) RunWorker() {
|
||||
|
||||
buf := make([]byte, CLIENT_READ_BUFFSIZE)
|
||||
|
||||
s.clientConn.SetReadDeadline(time.Now().Add(CLIENT_KEEPALIVE_EVERY * time.Second))
|
||||
ln, err := s.clientConn.Read(buf)
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break // abandon thread
|
||||
}
|
||||
|
||||
// If this was a /timeout/, send a KA and continue.
|
||||
if libnmdc.CheckIsNetTimeout(err) {
|
||||
s.writeClient("PING :" + s.name)
|
||||
continue
|
||||
}
|
||||
|
||||
// But otherwise, it was a real error (e.g. unexpected disconnect)
|
||||
s.verboseln(err.Error())
|
||||
|
@ -24,9 +24,9 @@ const (
|
||||
BLESSED_CHANNEL = "#chat" // must be lowercase
|
||||
BLESSED_CHANNEL_MODE = "n" // means that you have to be in the channel to chat, but that's it
|
||||
|
||||
NICKS_PER_PROTOMSG = 128 //The capacity sets the max number of nicks to send per message
|
||||
NICKS_PER_PROTOMSG = 128 // Max number of nicks to send per message
|
||||
CLIENT_READ_BUFFSIZE = 512
|
||||
CLIENT_READ_TIMEOUT_SEC = 3
|
||||
CLIENT_KEEPALIVE_EVERY = 60 // should be longer than the client's one, hexchat is 30s
|
||||
)
|
||||
|
||||
type replyCode int
|
||||
|
Loading…
Reference in New Issue
Block a user