Skip to content

Commit 190c143

Browse files
authored
Merge branch 'main' into lukebakken/nil-for-cleanup
2 parents 5f04849 + 30f5d55 commit 190c143

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

connection.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,13 +601,17 @@ func (c *Connection) dispatch0(f frame) {
601601

602602
func (c *Connection) dispatchN(f frame) {
603603
c.m.Lock()
604-
channel := c.channels[f.channel()]
605-
updateChannel(f, channel)
604+
channel, ok := c.channels[f.channel()]
605+
if ok {
606+
updateChannel(f, channel)
607+
} else {
608+
Logger.Printf("[debug] dropping frame, channel %d does not exist", f.channel())
609+
}
606610
c.m.Unlock()
607611

608612
// Note: this could result in concurrent dispatch depending on
609613
// how channels are managed in an application
610-
if channel != nil {
614+
if ok {
611615
channel.recv(channel, f)
612616
} else {
613617
c.dispatchClosed(f)

0 commit comments

Comments
 (0)