Browse Source

Added ConnectionWorkerPoolSize parameter to config

Rod Hynes 11 years ago
parent
commit
333ea00df4
2 changed files with 6 additions and 1 deletions
  1. 5 0
      psiphon/config.go
  2. 1 1
      psiphon/runTunnel.go

+ 5 - 0
psiphon/config.go

@@ -38,6 +38,7 @@ type Config struct {
 	TunnelProtocol                     string
 	LocalSocksProxyPort                int
 	LocalHttpProxyPort                 int
+	ConnectionWorkerPoolSize           int
 }
 
 // LoadConfig reads, and parse, and validates a JSON format Psiphon config
@@ -73,5 +74,9 @@ func LoadConfig(filename string) (*Config, error) {
 		}
 	}
 
+	if config.ConnectionWorkerPoolSize == 0 {
+		config.ConnectionWorkerPoolSize = CONNECTION_WORKER_POOL_SIZE
+	}
+
 	return &config, nil
 }

+ 1 - 1
psiphon/runTunnel.go

@@ -87,7 +87,7 @@ func establishTunnel(config *Config, sessionId string) (tunnel *Tunnel, err erro
 	establishedTunnels := make(chan *Tunnel, 1)
 	timeout := time.After(ESTABLISH_TUNNEL_TIMEOUT)
 	broadcastStopWorkers := make(chan struct{})
-	for i := 0; i < CONNECTION_WORKER_POOL_SIZE; i++ {
+	for i := 0; i < config.ConnectionWorkerPoolSize; i++ {
 		workerWaitGroup.Add(1)
 		go establishTunnelWorker(
 			config.TunnelProtocol, sessionId,