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