Don't reply to PING when client is unregistered

This commit is contained in:
Simon Ser 2020-03-16 14:32:38 +01:00
parent b1b519d4f9
commit 87684f7eab
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -303,13 +303,6 @@ func (dc *downstreamConn) handleMessage(msg *irc.Message) error {
switch msg.Command { switch msg.Command {
case "QUIT": case "QUIT":
return dc.Close() return dc.Close()
case "PING":
dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(),
Command: "PONG",
Params: msg.Params,
})
return nil
default: default:
if dc.registered { if dc.registered {
return dc.handleMessageRegistered(msg) return dc.handleMessageRegistered(msg)
@ -510,6 +503,13 @@ func (dc *downstreamConn) runUntilRegistered() error {
func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error { func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
switch msg.Command { switch msg.Command {
case "PING":
dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(),
Command: "PONG",
Params: msg.Params,
})
return nil
case "USER": case "USER":
return ircError{&irc.Message{ return ircError{&irc.Message{
Command: irc.ERR_ALREADYREGISTERED, Command: irc.ERR_ALREADYREGISTERED,