Skip to content

Commit

Permalink
fix rare panic when local index collision happens (#1191)
Browse files Browse the repository at this point in the history
A local index collision happens when two tunnels attempt to use the same
random int32 index ID. This is a rare chance, and we have code to deal
with it, but we have a panic because we return the wrong thing in this
case. This change should fix the panic.
  • Loading branch information
wadey authored Aug 7, 2024
1 parent 9a63fa0 commit f5f6c26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion handshake_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ func (c *HandshakeManager) CheckAndComplete(hostinfo *HostInfo, handshakePacket
existingPendingIndex, found := c.indexes[hostinfo.localIndexId]
if found && existingPendingIndex.hostinfo != hostinfo {
// We have a collision, but for a different hostinfo
return existingIndex, ErrLocalIndexCollision
return existingPendingIndex.hostinfo, ErrLocalIndexCollision
}

existingRemoteIndex, found := c.mainHostMap.RemoteIndexes[hostinfo.remoteIndexId]
Expand Down

0 comments on commit f5f6c26

Please sign in to comment.