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:
David Fifield 2018-12-04 17:11:29 -07:00
parent 297ae7b1b8
commit ab34f8e889

View file

@ -171,7 +171,7 @@ class ProxyPair
@relay.bufferedAmount < @MAX_BUFFER &&
@c2rSchedule.length > 0
chunk = @c2rSchedule.shift()
@rateLimit.update chunk.length
@rateLimit.update chunk.byteLength
@relay.send chunk
busy = true
# websocket --> WebRTC
@ -179,7 +179,7 @@ class ProxyPair
@client.bufferedAmount < @MAX_BUFFER &&
@r2cSchedule.length > 0
chunk = @r2cSchedule.shift()
@rateLimit.update chunk.length
@rateLimit.update chunk.byteLength
@client.send chunk
busy = true