Procházet zdrojové kódy

Merge remote-tracking branch 'upstream/master'

Adam Pritchard před 11 roky
rodič
revize
e2948bf0c5
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      psiphon/tunnel.go

+ 2 - 1
psiphon/tunnel.go

@@ -222,8 +222,8 @@ func EstablishTunnel(
 
 
 	// Run a goroutine to periodically execute SSH keepalive
 	// Run a goroutine to periodically execute SSH keepalive
 	sshKeepAliveQuit := make(chan struct{})
 	sshKeepAliveQuit := make(chan struct{})
-	sshKeepAliveTicker := time.NewTicker(TUNNEL_SSH_KEEP_ALIVE_PERIOD)
 	go func() {
 	go func() {
+		sshKeepAliveTicker := time.NewTicker(TUNNEL_SSH_KEEP_ALIVE_PERIOD)
 		for {
 		for {
 			select {
 			select {
 			case <-sshKeepAliveTicker.C:
 			case <-sshKeepAliveTicker.C:
@@ -258,6 +258,7 @@ func EstablishTunnel(
 func (tunnel *Tunnel) Close() {
 func (tunnel *Tunnel) Close() {
 	if tunnel.sshKeepAliveQuit != nil {
 	if tunnel.sshKeepAliveQuit != nil {
 		close(tunnel.sshKeepAliveQuit)
 		close(tunnel.sshKeepAliveQuit)
+		tunnel.sshKeepAliveQuit = nil
 	}
 	}
 	if tunnel.conn != nil {
 	if tunnel.conn != nil {
 		tunnel.conn.Close()
 		tunnel.conn.Close()