Просмотр исходного кода

When TargetServerEntry is set, use a worker pool size of 1.

Rod Hynes 7 лет назад
Родитель
Сommit
66daa2ccdb
2 измененных файлов с 11 добавлено и 1 удалено
  1. 2 1
      psiphon/config.go
  2. 9 0
      psiphon/controller.go

+ 2 - 1
psiphon/config.go

@@ -277,7 +277,8 @@ type Config struct {
 
 	// TargetServerEntry is an encoded server entry. When specified, this
 	// server entry is used exclusively and all other known servers are
-	// ignored.
+	// ignored; also, when set, ConnectionWorkerPoolSize is ignored and
+	// the pool size is 1.
 	TargetServerEntry string
 
 	// DisableApi disables Psiphon server API calls including handshake,

+ 9 - 0
psiphon/controller.go

@@ -1220,6 +1220,15 @@ func (controller *Controller) launchEstablishing() {
 	workerPoolSize := controller.config.clientParameters.Get().Int(
 		parameters.ConnectionWorkerPoolSize)
 
+	// When TargetServerEntry is used, override any worker pool size config or
+	// tactic parameter and use a pool size of 1. The typical use case for
+	// TargetServerEntry is to test a specific server with a single connection
+	// attempt. Furthermore, too many concurrent attempts to connect to the
+	// same server will trigger rate limiting.
+	if controller.config.TargetServerEntry != "" {
+		workerPoolSize = 1
+	}
+
 	p = nil
 
 	// If InitialLimitTunnelProtocols is configured but cannot be satisfied,