mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Use chunk.byteLength as appropriate for ArrayBuffers.
Without this, running with non-dummy rate limiter (e.g. ?ratelimit=1000) would try to add undefined to a number resulting in NaN.
This commit is contained in:
parent
297ae7b1b8
commit
ab34f8e889
1 changed files with 2 additions and 2 deletions
|
@ -171,7 +171,7 @@ class ProxyPair
|
||||||
@relay.bufferedAmount < @MAX_BUFFER &&
|
@relay.bufferedAmount < @MAX_BUFFER &&
|
||||||
@c2rSchedule.length > 0
|
@c2rSchedule.length > 0
|
||||||
chunk = @c2rSchedule.shift()
|
chunk = @c2rSchedule.shift()
|
||||||
@rateLimit.update chunk.length
|
@rateLimit.update chunk.byteLength
|
||||||
@relay.send chunk
|
@relay.send chunk
|
||||||
busy = true
|
busy = true
|
||||||
# websocket --> WebRTC
|
# websocket --> WebRTC
|
||||||
|
@ -179,7 +179,7 @@ class ProxyPair
|
||||||
@client.bufferedAmount < @MAX_BUFFER &&
|
@client.bufferedAmount < @MAX_BUFFER &&
|
||||||
@r2cSchedule.length > 0
|
@r2cSchedule.length > 0
|
||||||
chunk = @r2cSchedule.shift()
|
chunk = @r2cSchedule.shift()
|
||||||
@rateLimit.update chunk.length
|
@rateLimit.update chunk.byteLength
|
||||||
@client.send chunk
|
@client.send chunk
|
||||||
busy = true
|
busy = true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue