mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Fix PING and PONG
This commit is contained in:
parent
e19c1527a4
commit
34a099b61a
@ -27,6 +27,7 @@ type Client struct {
|
||||
channels ChannelSet
|
||||
ctime time.Time
|
||||
flags map[UserMode]bool
|
||||
isQuitting bool
|
||||
hasQuit bool
|
||||
hops uint
|
||||
hostname Name
|
||||
@ -99,7 +100,7 @@ func (client *Client) run() {
|
||||
}
|
||||
|
||||
isExiting = cmd.Run(client.server, client, msg)
|
||||
if isExiting {
|
||||
if isExiting || client.isQuitting {
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -114,6 +115,7 @@ func (client *Client) run() {
|
||||
|
||||
func (client *Client) connectionTimeout() {
|
||||
client.Quit("connection timeout")
|
||||
client.isQuitting = true
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -419,15 +419,14 @@ func quitHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
|
||||
// PING <server1> [<server2>]
|
||||
func pingHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
// client.Socket.Send(response here)
|
||||
return true
|
||||
client.Send(nil, server.nameString, "PONG", msg.Params...)
|
||||
return false
|
||||
}
|
||||
|
||||
// PONG <server> [ <server2> ]
|
||||
func pongHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
//TODO(dan): update client idle timer from this
|
||||
//TODO(dan): use this to affect how often we send pings
|
||||
return true
|
||||
// client gets touched when they send this command, so we don't need to do anything
|
||||
return false
|
||||
}
|
||||
|
||||
// JOIN <channel>{,<channel>} [<key>{,<key>}]
|
||||
|
Loading…
Reference in New Issue
Block a user