Broadcast unhandled messages to downstream connections

In case labelled-response isn't supported, broadcast unhandled messages
to all downstream connections. That's better than silently dropping the
messages.
This commit is contained in:
Simon Ser 2020-07-08 18:21:52 +02:00
parent 1685ba23b3
commit 51dc9f0bf9
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -1315,7 +1315,6 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
} }
} }
if downstreamID != 0 {
uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: uc.srv.prefix(), Prefix: uc.srv.prefix(),
@ -1323,7 +1322,6 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
Params: []string{dc.nick, command, reason}, Params: []string{dc.nick, command, reason},
}) })
}) })
}
case "ACK": case "ACK":
// Ignore // Ignore
case irc.RPL_NOWAWAY, irc.RPL_UNAWAY: case irc.RPL_NOWAWAY, irc.RPL_UNAWAY:
@ -1347,7 +1345,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
fallthrough fallthrough
default: default:
uc.logger.Printf("unhandled message: %v", msg) uc.logger.Printf("unhandled message: %v", msg)
if downstreamID != 0 {
uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) {
// best effort marshaling for unknown messages, replies and errors: // best effort marshaling for unknown messages, replies and errors:
// most numerics start with the user nick, marshal it if that's the case // most numerics start with the user nick, marshal it if that's the case
@ -1365,7 +1363,6 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
}) })
}) })
} }
}
return nil return nil
} }