Przeglądaj źródła

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 miesięcy temu
rodzic
commit
61d88a4250
2 zmienionych plików z 1 dodań i 7 usunięć
  1. 1 2
      psiphon/notice.go
  2. 0 5
      psiphon/serverApi.go

+ 1 - 2
psiphon/notice.go

@@ -1004,8 +1004,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

@@ -275,11 +275,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 := responseUnmarshaler(response, &handshakeResponse)
 	if err != nil {
 		return errors.Trace(err)