Преглед изворни кода

Remove -1 defaults for NoticeTrafficRateLimits

Servers will always report Up/DownstreamBytesPerSecond values. omitempty is
now used in HandshakeResponse JSON/CBOR encodings to reduce the size of the
handshake traffic when the fields happen to be zero values. The old -1
default was not compatible with this omitempty optimization.
Rod Hynes пре 3 месеци
родитељ
комит
996f485b1e
2 измењених фајлова са 1 додато и 7 уклоњено
  1. 1 2
      psiphon/notice.go
  2. 0 5
      psiphon/serverApi.go

+ 1 - 2
psiphon/notice.go

@@ -1002,8 +1002,7 @@ func NoticeActiveAuthorizationIDs(diagnosticID string, activeAuthorizationIDs []
 
 // NoticeTrafficRateLimits reports the tunnel traffic rate limits in place for
 // this client, as reported by the server at the start of the tunnel. Values
-// of 0 indicate no limit. Values of -1 indicate that the server did not
-// report rate limits.
+// of 0 indicate no limit.
 //
 // Limitation: any rate limit changes during the lifetime of the tunnel are
 // not reported.

+ 0 - 5
psiphon/serverApi.go

@@ -257,11 +257,6 @@ func (serverContext *ServerContext) doHandshakeRequest(ignoreStatsRegexps bool)
 
 	var handshakeResponse protocol.HandshakeResponse
 
-	// Initialize these fields to distinguish between psiphond omitting values in
-	// the response and the zero value, which means unlimited rate.
-	handshakeResponse.UpstreamBytesPerSecond = -1
-	handshakeResponse.DownstreamBytesPerSecond = -1
-
 	err := json.Unmarshal(response, &handshakeResponse)
 	if err != nil {
 		return errors.Trace(err)