|
@@ -1641,9 +1641,19 @@ func (sshServer *sshServer) stopClients() {
|
|
|
sshServer.clients = make(map[string]*sshClient)
|
|
sshServer.clients = make(map[string]*sshClient)
|
|
|
sshServer.clientsMutex.Unlock()
|
|
sshServer.clientsMutex.Unlock()
|
|
|
|
|
|
|
|
|
|
+ // Stop clients concurrently; if any one client stop hangs, due to a bug,
|
|
|
|
|
+ // this ensures that we still stop and record a server_tunnel for all
|
|
|
|
|
+ // non-hanging clients.
|
|
|
|
|
+
|
|
|
|
|
+ waitGroup := new(sync.WaitGroup)
|
|
|
for _, client := range clients {
|
|
for _, client := range clients {
|
|
|
- client.stop()
|
|
|
|
|
|
|
+ waitGroup.Add(1)
|
|
|
|
|
+ go func(c *sshClient) {
|
|
|
|
|
+ defer waitGroup.Done()
|
|
|
|
|
+ c.stop()
|
|
|
|
|
+ }(client)
|
|
|
}
|
|
}
|
|
|
|
|
+ waitGroup.Wait()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (sshServer *sshServer) handleClient(
|
|
func (sshServer *sshServer) handleClient(
|