Ver código fonte

Fix: "Unreported persistent stats" count was always 1

- Also fix failed_tunnel validation cases.
Rod Hynes 7 anos atrás
pai
commit
62211b75b3
3 arquivos alterados com 8 adições e 3 exclusões
  1. 0 1
      psiphon/dataStore.go
  2. 7 1
      psiphon/server/api.go
  3. 1 1
      psiphon/serverApi.go

+ 0 - 1
psiphon/dataStore.go

@@ -1029,7 +1029,6 @@ func CountUnreportedPersistentStats() int {
 			for key, value := cursor.first(); key != nil; key, value = cursor.next() {
 				if 0 == bytes.Compare(value, persistentStatStateUnreported) {
 					unreported++
-					break
 				}
 			}
 			cursor.close()

+ 7 - 1
psiphon/server/api.go

@@ -492,7 +492,8 @@ func statusAPIRequestHandler(
 				return nil, common.ContextError(err)
 			}
 
-			// remote_server_list defaults to using the common params from the outer statusRequestParams
+			// remote_server_list defaults to using the common params from the
+			// outer statusRequestParams
 			remoteServerListFields := getRequestLogFields(
 				"remote_server_list",
 				geoIPData,
@@ -519,6 +520,11 @@ func statusAPIRequestHandler(
 		}
 		for _, failedTunnelStat := range failedTunnelStats {
 
+			// failed_tunnel supplies a full set of common params, but the
+			// server secret must use the corect value from the outer
+			// statusRequestParams
+			failedTunnelStat["server_secret"] = params["server_secret"]
+
 			err := validateRequestParams(support.Config, failedTunnelStat, failedTunnelStatParams)
 			if err != nil {
 				return nil, common.ContextError(err)

+ 1 - 1
psiphon/serverApi.go

@@ -485,7 +485,7 @@ func makeStatusRequestPayload(
 
 	persistentStatPayloadNames := make(map[string]string)
 	persistentStatPayloadNames[datastorePersistentStatTypeRemoteServerList] = "remote_server_list_stats"
-	persistentStatPayloadNames[datastorePersistentStatTypeFailedTunnel] = "failed_tunnels"
+	persistentStatPayloadNames[datastorePersistentStatTypeFailedTunnel] = "failed_tunnel_stats"
 
 	for statType, stats := range persistentStats {