Fix PING and PONG

This commit is contained in:
Daniel Oaks 2016-06-22 22:04:13 +10:00
parent e19c1527a4
commit 34a099b61a
2 changed files with 7 additions and 6 deletions

View File

@ -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
}
//

View File

@ -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>}]