Avoid sending JOIN twice for the same channel

This commit is contained in:
Simon Ser 2020-03-20 22:53:05 +01:00
parent 45d118dd12
commit 7114c8a1e9
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
2 changed files with 6 additions and 6 deletions

View File

@ -11,12 +11,6 @@ func forwardChannel(dc *downstreamConn, ch *upstreamChannel) {
downstreamName := dc.marshalChannel(ch.conn, ch.Name) downstreamName := dc.marshalChannel(ch.conn, ch.Name)
dc.SendMessage(&irc.Message{
Prefix: dc.prefix(),
Command: "JOIN",
Params: []string{downstreamName},
})
if ch.Topic != "" { if ch.Topic != "" {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),

View File

@ -700,6 +700,12 @@ func (dc *downstreamConn) register() error {
dc.forEachUpstream(func(uc *upstreamConn) { dc.forEachUpstream(func(uc *upstreamConn) {
for _, ch := range uc.channels { for _, ch := range uc.channels {
if ch.complete { if ch.complete {
dc.SendMessage(&irc.Message{
Prefix: dc.prefix(),
Command: "JOIN",
Params: []string{dc.marshalChannel(ch.conn, ch.Name)},
})
forwardChannel(dc, ch) forwardChannel(dc, ch)
} }
} }