Explorar el Código

Workaround for tun.Client shutdown hang

- Same workaround as used for server in 4adf37d
Rod Hynes hace 8 años
padre
commit
3af273bdb5
Se han modificado 2 ficheros con 10 adiciones y 4 borrados
  1. 10 3
      psiphon/common/tun/tun.go
  2. 0 1
      psiphon/tunnel.go

+ 10 - 3
psiphon/common/tun/tun.go

@@ -289,8 +289,12 @@ func (server *Server) Start() {
 
 	// TODO: this is a hack workaround for deviceIO.Read()
 	// not getting interrupted by deviceIO.Close(), and, as a
-	// result, runDeviceDownstream no terminating. This
-	// workaround breaks synchronized shutdown.
+	// result, runDeviceDownstream not terminating.
+	//
+	// This workaround breaks synchronized shutdown and leaves
+	// behind a hung goroutine which holds references to various
+	// objects; it's only suitable when Server.Stop() is
+	// followed by termination of the process.
 	//
 	//server.workers.Add(1)
 	go server.runDeviceDownstream()
@@ -1362,7 +1366,10 @@ func (client *Client) Start() {
 
 	client.config.Logger.WithContext().Info("starting")
 
-	client.workers.Add(1)
+	// TODO: this is a hack workaround for the same issue
+	// documented in Server.Start().
+	//
+	//client.workers.Add(1)
 	go func() {
 		defer client.workers.Done()
 		for {

+ 0 - 1
psiphon/tunnel.go

@@ -316,7 +316,6 @@ func (tunnel *Tunnel) DialPacketTunnelChannel() (net.Conn, error) {
 	channel, requests, err := tunnel.sshClient.OpenChannel(
 		protocol.PACKET_TUNNEL_CHANNEL_TYPE, nil)
 	if err != nil {
-
 		// TODO: conditional on type of error or error message?
 		select {
 		case tunnel.signalPortForwardFailure <- *new(struct{}):