mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
derp: add (*Server).IsClientConnectedForTest func. (#4331)
This allows tests to verfiy that a DERP connection was actually established. Related to #4326 Updates tailscale/corp#2579 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
3d180c0376
commit
9f604f2bd3
@ -391,6 +391,18 @@ func (s *Server) isClosed() bool {
|
||||
return s.closed
|
||||
}
|
||||
|
||||
// IsClientConnectedForTest reports whether the client with specified key is connected.
|
||||
// This is used in tests to verify that nodes are connected.
|
||||
func (s *Server) IsClientConnectedForTest(k key.NodePublic) bool {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
x, ok := s.clients[k]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return x.ActiveClient() != nil
|
||||
}
|
||||
|
||||
// Accept adds a new connection to the server and serves it.
|
||||
//
|
||||
// The provided bufio ReadWriter must be already connected to nc.
|
||||
|
Loading…
x
Reference in New Issue
Block a user