Skip to content

Commit f5f6c26

Browse files
authored
fix rare panic when local index collision happens (#1191)
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.
1 parent 9a63fa0 commit f5f6c26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

handshake_manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ func (c *HandshakeManager) CheckAndComplete(hostinfo *HostInfo, handshakePacket
488488
existingPendingIndex, found := c.indexes[hostinfo.localIndexId]
489489
if found && existingPendingIndex.hostinfo != hostinfo {
490490
// We have a collision, but for a different hostinfo
491-
return existingIndex, ErrLocalIndexCollision
491+
return existingPendingIndex.hostinfo, ErrLocalIndexCollision
492492
}
493493

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

0 commit comments

Comments
 (0)