Browse Source

Rename established_tunnel_count to established_tunnels_count

Rod Hynes 6 years ago
parent
commit
5cda464958

+ 3 - 3
psiphon/controller.go

@@ -68,7 +68,7 @@ type Controller struct {
 	establishCtx                            context.Context
 	stopEstablish                           context.CancelFunc
 	establishWaitGroup                      *sync.WaitGroup
-	establishedTunnelCount                  int32
+	establishedTunnelsCount                 int32
 	candidateServerEntries                  chan *candidateServerEntry
 	untunneledDialConfig                    *DialConfig
 	splitTunnelClassifier                   *SplitTunnelClassifier
@@ -733,7 +733,7 @@ loop:
 				break
 			}
 
-			atomic.AddInt32(&controller.establishedTunnelCount, 1)
+			atomic.AddInt32(&controller.establishedTunnelsCount, 1)
 
 			NoticeActiveTunnel(
 				connectedTunnel.dialParams.ServerEntry.GetDiagnosticID(),
@@ -1930,7 +1930,7 @@ loop:
 			candidateServerEntry.serverEntry,
 			false,
 			controller.establishConnectTunnelCount,
-			int(atomic.LoadInt32(&controller.establishedTunnelCount)))
+			int(atomic.LoadInt32(&controller.establishedTunnelsCount)))
 		if dialParams == nil || err != nil {
 
 			controller.concurrentEstablishTunnelsMutex.Unlock()

+ 7 - 7
psiphon/dialParameters.go

@@ -58,11 +58,11 @@ import (
 //
 // DialParameters is not safe for concurrent use.
 type DialParameters struct {
-	ServerEntry            *protocol.ServerEntry `json:"-"`
-	NetworkID              string                `json:"-"`
-	IsReplay               bool                  `json:"-"`
-	CandidateNumber        int                   `json:"-"`
-	EstablishedTunnelCount int                   `json:"-"`
+	ServerEntry             *protocol.ServerEntry `json:"-"`
+	NetworkID               string                `json:"-"`
+	IsReplay                bool                  `json:"-"`
+	CandidateNumber         int                   `json:"-"`
+	EstablishedTunnelsCount int                   `json:"-"`
 
 	IsExchanged bool
 
@@ -151,7 +151,7 @@ func MakeDialParameters(
 	serverEntry *protocol.ServerEntry,
 	isTactics bool,
 	candidateNumber int,
-	establishedTunnelCount int) (*DialParameters, error) {
+	establishedTunnelsCount int) (*DialParameters, error) {
 
 	networkID := config.GetNetworkID()
 
@@ -269,7 +269,7 @@ func MakeDialParameters(
 	dialParams.NetworkID = networkID
 	dialParams.IsReplay = isReplay
 	dialParams.CandidateNumber = candidateNumber
-	dialParams.EstablishedTunnelCount = establishedTunnelCount
+	dialParams.EstablishedTunnelsCount = establishedTunnelsCount
 
 	// Even when replaying, LastUsedTimestamp is updated to extend the TTL of
 	// replayed dial parameters which will be updated in the datastore upon

+ 1 - 1
psiphon/notice.go

@@ -433,7 +433,7 @@ func noticeWithDialParameters(noticeType string, dialParams *DialParameters) {
 		"protocol", dialParams.TunnelProtocol,
 		"isReplay", dialParams.IsReplay,
 		"candidateNumber", dialParams.CandidateNumber,
-		"establishedTunnelCount", dialParams.EstablishedTunnelCount,
+		"establishedTunnelsCount", dialParams.EstablishedTunnelsCount,
 		"networkType", dialParams.GetNetworkType(),
 	}
 

+ 8 - 8
psiphon/server/api.go

@@ -205,9 +205,9 @@ func handshakeAPIRequestHandler(
 	isMobile := isMobileClientPlatform(clientPlatform)
 	normalizedPlatform := normalizeClientPlatform(clientPlatform)
 
-	// establishedTunnelCount is used in traffic rule selection. When omitted by
+	// establishedTunnelsCount is used in traffic rule selection. When omitted by
 	// the client, a value of 0 will be used.
-	establishedTunnelCount, _ := getIntStringRequestParam(params, "established_tunnel_count")
+	establishedTunnelsCount, _ := getIntStringRequestParam(params, "established_tunnels_count")
 
 	var authorizations []string
 	if params[protocol.PSIPHON_API_HANDSHAKE_AUTHORIZATIONS] != nil {
@@ -231,11 +231,11 @@ func handshakeAPIRequestHandler(
 	handshakeStateInfo, err := support.TunnelServer.SetClientHandshakeState(
 		sessionID,
 		handshakeState{
-			completed:              true,
-			apiProtocol:            apiProtocol,
-			apiParams:              copyBaseRequestParams(params),
-			expectDomainBytes:      len(httpsRequestRegexes) > 0,
-			establishedTunnelCount: establishedTunnelCount,
+			completed:               true,
+			apiProtocol:             apiProtocol,
+			apiParams:               copyBaseRequestParams(params),
+			expectDomainBytes:       len(httpsRequestRegexes) > 0,
+			establishedTunnelsCount: establishedTunnelsCount,
 		},
 		authorizations)
 	if err != nil {
@@ -775,7 +775,7 @@ var baseRequestParams = []requestParamSpec{
 	{"egress_region", isRegionCode, requestParamOptional},
 	{"dial_duration", isIntString, requestParamOptional | requestParamLogStringAsInt},
 	{"candidate_number", isIntString, requestParamOptional | requestParamLogStringAsInt},
-	{"established_tunnel_count", isIntString, requestParamOptional | requestParamLogStringAsInt},
+	{"established_tunnels_count", isIntString, requestParamOptional | requestParamLogStringAsInt},
 	{"upstream_ossh_padding", isIntString, requestParamOptional | requestParamLogStringAsInt},
 	{"meek_cookie_size", isIntString, requestParamOptional | requestParamLogStringAsInt},
 	{"meek_limit_request", isIntString, requestParamOptional | requestParamLogStringAsInt},

+ 1 - 1
psiphon/server/server_test.go

@@ -1185,7 +1185,7 @@ func checkExpectedLogFields(
 		"is_replay",
 		"dial_duration",
 		"candidate_number",
-		"established_tunnel_count",
+		"established_tunnels_count",
 		"network_latency_multiplier",
 		"network_type",
 		"client_app_id",

+ 8 - 8
psiphon/server/tunnelServer.go

@@ -1225,13 +1225,13 @@ type qualityMetrics struct {
 }
 
 type handshakeState struct {
-	completed              bool
-	apiProtocol            string
-	apiParams              common.APIParameters
-	authorizedAccessTypes  []string
-	authorizationsRevoked  bool
-	expectDomainBytes      bool
-	establishedTunnelCount int
+	completed               bool
+	apiProtocol             string
+	apiParams               common.APIParameters
+	authorizedAccessTypes   []string
+	authorizationsRevoked   bool
+	expectDomainBytes       bool
+	establishedTunnelsCount int
 }
 
 type handshakeStateInfo struct {
@@ -2740,7 +2740,7 @@ func (sshClient *sshClient) setTrafficRules() (int64, int64) {
 	defer sshClient.Unlock()
 
 	isFirstTunnelInSession := sshClient.isFirstTunnelInSession &&
-		sshClient.handshakeState.establishedTunnelCount == 0
+		sshClient.handshakeState.establishedTunnelsCount == 0
 
 	sshClient.trafficRules = sshClient.sshServer.support.TrafficRulesSet.GetTrafficRules(
 		isFirstTunnelInSession,

+ 1 - 1
psiphon/serverApi.go

@@ -942,7 +942,7 @@ func getBaseAPIParameters(
 
 	params["candidate_number"] = strconv.Itoa(dialParams.CandidateNumber)
 
-	params["established_tunnel_count"] = strconv.Itoa(dialParams.EstablishedTunnelCount)
+	params["established_tunnels_count"] = strconv.Itoa(dialParams.EstablishedTunnelsCount)
 
 	if dialParams.NetworkLatencyMultiplier != 0.0 {
 		params["network_latency_multiplier"] =