Explorar o código

Merge branch 'master' of https://github.com/Psiphon-Labs/psiphon-tunnel-core

Rod Hynes %!s(int64=9) %!d(string=hai) anos
pai
achega
26cc81b2b2
Modificáronse 1 ficheiros con 16 adicións e 10 borrados
  1. 16 10
      psiphon/controller.go

+ 16 - 10
psiphon/controller.go

@@ -586,17 +586,23 @@ loop:
 
 				NoticeAlert("established tunnel with impaired protocol: %s", establishedTunnel.protocol)
 
-				// Protocol was classified as impaired while this tunnel
-				// established, so discard.
-				controller.discardTunnel(establishedTunnel)
-
-				// Reset establish generator to stop producing tunnels
-				// with impaired protocols.
-				if controller.isEstablishing {
-					controller.stopEstablishing()
-					controller.startEstablishing()
+				// Take action only when TunnelProtocol is unset, as it limits the
+				// controller to a single protocol. For testing and diagnostics, we
+				// still allow classification when TunnelProtocol is set.
+				if controller.config.TunnelProtocol == "" {
+
+					// Protocol was classified as impaired while this tunnel
+					// established, so discard.
+					controller.discardTunnel(establishedTunnel)
+
+					// Reset establish generator to stop producing tunnels
+					// with impaired protocols.
+					if controller.isEstablishing {
+						controller.stopEstablishing()
+						controller.startEstablishing()
+					}
+					break
 				}
-				break
 			}
 
 			tunnelCount, registered := controller.registerTunnel(establishedTunnel)