فهرست منبع

Fix: response protocol version not set when no-match

Rod Hynes 1 سال پیش
والد
کامیت
77cbabbc60
2فایلهای تغییر یافته به همراه20 افزوده شده و 14 حذف شده
  1. 10 7
      psiphon/common/inproxy/client.go
  2. 10 7
      psiphon/common/inproxy/proxy.go

+ 10 - 7
psiphon/common/inproxy/client.go

@@ -345,21 +345,24 @@ func dialClientWebRTCConn(
 		return nil, false, errors.Trace(err)
 	}
 
-	// No retry when rate/entry limited or when the proxy protocols is
-	// incompatible; do retry on no-match, as a match may soon appear.
+	// No retry when rate/entry limited; do retry on no-match, as a match may
+	// soon appear.
 
 	if offerResponse.Limited {
 		return nil, false, errors.TraceNew("limited")
 
-	} else if offerResponse.SelectedProxyProtocolVersion != ProxyProtocolVersion1 {
+	} else if offerResponse.NoMatch {
+
+		return nil, true, errors.TraceNew("no proxy match")
+
+	}
 
+	if offerResponse.SelectedProxyProtocolVersion != ProxyProtocolVersion1 {
+		// This case is currently unexpected, as all clients and proxies use
+		// ProxyProtocolVersion1.
 		return nil, false, errors.Tracef(
 			"Unsupported proxy protocol version: %d",
 			offerResponse.SelectedProxyProtocolVersion)
-
-	} else if offerResponse.NoMatch {
-
-		return nil, true, errors.TraceNew("no proxy match")
 	}
 
 	// Establish the WebRTC DataChannel connection

+ 10 - 7
psiphon/common/inproxy/proxy.go

@@ -608,24 +608,27 @@ func (p *Proxy) proxyOneClient(
 		signalAnnounceDone()
 	}
 
-	// Trigger back-off back off when rate/entry limited or when the proxy
-	// protocols is incompatible; no back-off for no-match.
+	// Trigger back-off back off when rate/entry limited; no back-off for
+	// no-match.
 
 	if announceResponse.Limited {
 
 		backOff = true
 		return backOff, errors.TraceNew("limited")
 
-	} else if announceResponse.ClientProxyProtocolVersion != ProxyProtocolVersion1 {
+	} else if announceResponse.NoMatch {
+
+		return backOff, errors.TraceNew("no match")
+
+	}
 
+	if announceResponse.ClientProxyProtocolVersion != ProxyProtocolVersion1 {
+		// This case is currently unexpected, as all clients and proxies use
+		// ProxyProtocolVersion1.
 		backOff = true
 		return backOff, errors.Tracef(
 			"Unsupported proxy protocol version: %d",
 			announceResponse.ClientProxyProtocolVersion)
-
-	} else if announceResponse.NoMatch {
-
-		return backOff, errors.TraceNew("no match")
 	}
 
 	// Trigger back-off if the following WebRTC operations fail to establish a