cmd/derper: treat self-connection connection watch as no-op

Updates #388
This commit is contained in:
Brad Fitzpatrick
2020-06-04 08:26:05 -07:00
parent 5798826990
commit b663ab4685
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -259,6 +259,13 @@ func (s *Server) addWatcher(c *sclient) {
panic("invariant: addWatcher called without permissions")
}
if c.key == s.publicKey {
// We're connecting to ourself. Do nothing.
// TODO(bradfitz): have client notice and disconnect
// so an idle TCP connection isn't kept open.
return
}
s.mu.Lock()
defer s.mu.Unlock()