Rod Hynes 10 лет назад
Родитель
Сommit
893e5a8526
2 измененных файлов с 5 добавлено и 2 удалено
  1. 4 0
      psiphon/controller.go
  2. 1 2
      psiphon/serverEntry.go

+ 4 - 0
psiphon/controller.go

@@ -487,6 +487,8 @@ func (controller *Controller) classifyImpairedProtocol(failedTunnel *Tunnel) {
 	if len(controller.getImpairedProtocols()) == len(SupportedTunnelProtocols) {
 		// Reset classification if all protocols are classified as impaired as
 		// the network situation (or attack) may not be protocol-specific.
+		// TODO: compare against count of distinct supported protocols for
+		// current known server entries.
 		controller.impairedProtocolClassification = make(map[string]int)
 	}
 }
@@ -796,6 +798,8 @@ loop:
 			// hopping on a mobile device).
 			// Impaired protocols logic is not applied when
 			// config.TunnelProtocol is specified.
+			// The edited serverEntry is temporary copy which is not
+			// stored or reused.
 			if i == 0 && controller.config.TunnelProtocol == "" {
 				serverEntry.DisableImpairedProtocols(impairedProtocols)
 				if len(serverEntry.GetSupportedProtocols()) == 0 {

+ 1 - 2
psiphon/serverEntry.go

@@ -80,8 +80,7 @@ func (serverEntry *ServerEntry) SupportsProtocol(protocol string) bool {
 func (serverEntry *ServerEntry) GetSupportedProtocols() []string {
 	supportedProtocols := make([]string, 0)
 	for _, protocol := range SupportedTunnelProtocols {
-		requiredCapability := strings.TrimSuffix(protocol, "-OSSH")
-		if Contains(serverEntry.Capabilities, requiredCapability) {
+		if serverEntry.SupportsProtocol(protocol) {
 			supportedProtocols = append(supportedProtocols, protocol)
 		}
 	}