Эх сурвалжийг харах

Support setting EstablishTunnelServerAffinityGracePeriod via config

Rod Hynes 7 жил өмнө
parent
commit
7170540202

+ 9 - 0
psiphon/config.go

@@ -178,6 +178,11 @@ type Config struct {
 	// typical overridden for testing.
 	EstablishTunnelPausePeriodSeconds *int
 
+	// EstablishTunnelPausePeriodSeconds specifies the grace period, or head
+	// start, provided to the affinity server candidate when establishing. The
+	// affinity server is the server used for the last established tunnel.
+	EstablishTunnelServerAffinityGracePeriodMilliseconds *int
+
 	// ConnectionWorkerPoolSize specifies how many connection attempts to
 	// attempt in parallel. If omitted of when 0, a default is used; this is
 	// recommended.
@@ -862,6 +867,10 @@ func (config *Config) makeConfigParameters() map[string]interface{} {
 		applyParameters[parameters.EstablishTunnelTimeout] = fmt.Sprintf("%ds", *config.EstablishTunnelTimeoutSeconds)
 	}
 
+	if config.EstablishTunnelServerAffinityGracePeriodMilliseconds != nil {
+		applyParameters[parameters.EstablishTunnelServerAffinityGracePeriod] = fmt.Sprintf("%dms", *config.EstablishTunnelServerAffinityGracePeriodMilliseconds)
+	}
+
 	if config.EstablishTunnelPausePeriodSeconds != nil {
 		applyParameters[parameters.EstablishTunnelPausePeriod] = fmt.Sprintf("%ds", *config.EstablishTunnelPausePeriodSeconds)
 	}

+ 0 - 2
psiphon/controller.go

@@ -1450,8 +1450,6 @@ func (controller *Controller) getTactics(done chan struct{}) {
 func (controller *Controller) doFetchTactics(
 	serverEntry *protocol.ServerEntry) (*tactics.Record, error) {
 
-	// *TODO: ...
-
 	canReplay := func(serverEntry *protocol.ServerEntry, replayProtocol string) bool {
 		return common.Contains(
 			serverEntry.GetSupportedTacticsProtocols(), replayProtocol)