Changeset 758 in code for trunk/downstream.go


Ignore:
Timestamp:
Dec 8, 2021, 5:23:46 PM (4 years ago)
Author:
contact
Message:

Don't forward duplicate JOIN commands

Closes: https://todo.sr.ht/~emersion/soju/171

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r757 r758  
    17721772                        }
    17731773
    1774                         params := []string{upstreamName}
    1775                         if key != "" {
    1776                                 params = append(params, key)
    1777                         }
    1778                         uc.SendMessageLabeled(ctx, dc.id, &irc.Message{
    1779                                 Command: "JOIN",
    1780                                 Params:  params,
    1781                         })
     1774                        // Most servers ignore duplicate JOIN messages. We ignore them here
     1775                        // because some clients automatically send JOIN messages in bulk
     1776                        // when reconnecting to the bouncer. We don't want to flood the
     1777                        // upstream connection with these.
     1778                        if !uc.channels.Has(upstreamName) {
     1779                                params := []string{upstreamName}
     1780                                if key != "" {
     1781                                        params = append(params, key)
     1782                                }
     1783                                uc.SendMessageLabeled(ctx, dc.id, &irc.Message{
     1784                                        Command: "JOIN",
     1785                                        Params:  params,
     1786                                })
     1787                        }
    17821788
    17831789                        ch := uc.network.channels.Value(upstreamName)
Note: See TracChangeset for help on using the changeset viewer.