浏览代码

add new fields to log test; remove unused struct fields

tmgrask 6 月之前
父节点
当前提交
6c505c43cc
共有 2 个文件被更改,包括 11 次插入5 次删除
  1. 11 0
      psiphon/server/server_test.go
  2. 0 5
      psiphon/server/tunnelServer.go

+ 11 - 0
psiphon/server/server_test.go

@@ -2425,6 +2425,9 @@ func checkExpectedServerTunnelLogFields(
 		"established_tunnels_count",
 		"network_latency_multiplier",
 		"network_type",
+		"bytes",
+		"ssh_protocol_bytes",
+		"ssh_protocol_bytes_overhead",
 
 		// The test run ensures that logServerLoad is invoked while the client
 		// is connected, so the following must be logged.
@@ -2436,6 +2439,14 @@ func checkExpectedServerTunnelLogFields(
 		}
 	}
 
+	if !(fields["ssh_protocol_bytes"].(int64) > 0) {
+		return fmt.Errorf("unexpected zero ssh_protocol_bytes")
+	}
+
+	if !(fields["ssh_protocol_bytes"].(int64) > fields["bytes"].(int64)) {
+		return fmt.Errorf("unexpected ssh_protocol_bytes < bytes")
+	}
+
 	appliedTacticsTag := len(fields[tactics.APPLIED_TACTICS_TAG_PARAMETER_NAME].(string)) > 0
 	if expectAppliedTacticsTag != appliedTacticsTag {
 		return fmt.Errorf("unexpected applied_tactics_tag")

+ 0 - 5
psiphon/server/tunnelServer.go

@@ -2261,17 +2261,12 @@ type sshProtocolBytesTracker struct {
 	// (https://golang.org/pkg/sync/atomic/#pkg-note-BUG)
 	totalBytesRead    int64
 	totalBytesWritten int64
-	sshClient         *sshClient
-	startTime         time.Time
 }
 
 func newSSHProtocolBytesTracker(sshClient *sshClient) *sshProtocolBytesTracker {
 	return &sshProtocolBytesTracker{
-		sshClient: sshClient,
-
 		totalBytesRead:    0,
 		totalBytesWritten: 0,
-		startTime:         time.Now(),
 	}
 }