Add check during initial handshake whether we already have an established connection to this peer
This commit is contained in:
1 parent
f9f29bbe42
commit
57aecb868f
1 file changed
+5
@@ -345,6 +345,11 @@ func (conn *LocalConnection) handshake(acceptNewPeer bool) error {
|
|||||||
return fmt.Errorf("Found unknown remote name: %s at %s", name, conn.remoteTCPAddr)
|
return fmt.Errorf("Found unknown remote name: %s at %s", name, conn.remoteTCPAddr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if existingConn, found := conn.local.ConnectionTo(name); found {
|
||||||
|
if existingConn.Established() {
|
||||||
|
return fmt.Errorf("Already have connection to %s at %s", name, existingConn.RemoteTCPAddr())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uidStr, err := checkHandshakeStringField("UID", "", handshakeRecv)
|
uidStr, err := checkHandshakeStringField("UID", "", handshakeRecv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user