<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/dcf/snowflake, branch arraybuffer</title>
<subtitle>David's Snowflake repository</subtitle>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/'/>
<entry>
<title>Use chunk.byteLength as appropriate for ArrayBuffers.</title>
<updated>2018-12-05T00:14:36+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-05T00:11:29+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=73f328fef8a9351afc47bb65a68b549fbab90cad'/>
<id>73f328fef8a9351afc47bb65a68b549fbab90cad</id>
<content type='text'>
Without this, running with non-dummy rate limiter (e.g. ?ratelimit=1000)
would try to add undefined to a number resulting in NaN.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without this, running with non-dummy rate limiter (e.g. ?ratelimit=1000)
would try to add undefined to a number resulting in NaN.
</pre>
</div>
</content>
</entry>
<entry>
<title>Test ProxyPair with ArrayBuffers, not strings.</title>
<updated>2018-12-05T00:14:36+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T23:55:12+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=119abd07db8114f7e0058fc1bf4627d201d44988'/>
<id>119abd07db8114f7e0058fc1bf4627d201d44988</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Log WebSocket→WebRTC messages in debug mode.</title>
<updated>2018-12-05T00:14:36+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T22:48:13+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=1e25f9e29c57889b64cef63e5bf60dedbfffbe73'/>
<id>1e25f9e29c57889b64cef63e5bf60dedbfffbe73</id>
<content type='text'>
Same as the other direction.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Same as the other direction.
</pre>
</div>
</content>
</entry>
<entry>
<title>Only console.log the number of bytes, not the literal message.</title>
<updated>2018-12-05T00:14:36+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T22:50:54+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=e00fab138d5455b563e28e5c9f7d459794349725'/>
<id>e00fab138d5455b563e28e5c9f7d459794349725</id>
<content type='text'>
It doesn't really help to have a bunch TLS application records
interpreted as a string written to the console.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It doesn't really help to have a bunch TLS application records
interpreted as a string written to the console.
</pre>
</div>
</content>
</entry>
<entry>
<title>Set binaryType="arraybuffer" for RTCDataChannel, just as with WebSocket.</title>
<updated>2018-12-05T00:14:36+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T22:28:19+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=ae221496773f82b7f6b669839e291f4a7fc283b5'/>
<id>ae221496773f82b7f6b669839e291f4a7fc283b5</id>
<content type='text'>
The binaryType can be "arraybuffer" or "blob", and "blob" is the
default. The code is only aware of "arraybuffer": I discovered a problem
while running snowflake.html in debug mode; this code fails:
    if DEBUG
      # Go sends only raw bytes...
      if '[object ArrayBuffer]' == recv.toString()
        bytes = new Uint8Array recv
        line = String.fromCharCode.apply(null, bytes)
      line = line.trim()
      log 'WebRTC --&gt; websocket data: ' + line
with the error:
	TypeError: line.trim is not a function[Learn More] snowflake.js:497:16
because recv is of type Blob, not ArrayBuffer.

Despite the unexpected type, the code seemed to work as expected when
not in debug mode. Though the two types provide different interfaces,
they are both valid to pass on to WebSocket.send. The only other thing
we did with it was try to read the .length member for rate-limiting
purposes:
        @rateLimit.update chunk.length
but .length is incorrect for either type: Blob uses .size and
ArrayBuffer uses .byteLength. It worked anyway, because
DummyRateLimit.update doesn't actually look at its argument.

We were already setting binaryType="arraybuffer" for WebSocket
connections.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The binaryType can be "arraybuffer" or "blob", and "blob" is the
default. The code is only aware of "arraybuffer": I discovered a problem
while running snowflake.html in debug mode; this code fails:
    if DEBUG
      # Go sends only raw bytes...
      if '[object ArrayBuffer]' == recv.toString()
        bytes = new Uint8Array recv
        line = String.fromCharCode.apply(null, bytes)
      line = line.trim()
      log 'WebRTC --&gt; websocket data: ' + line
with the error:
	TypeError: line.trim is not a function[Learn More] snowflake.js:497:16
because recv is of type Blob, not ArrayBuffer.

Despite the unexpected type, the code seemed to work as expected when
not in debug mode. Though the two types provide different interfaces,
they are both valid to pass on to WebSocket.send. The only other thing
we did with it was try to read the .length member for rate-limiting
purposes:
        @rateLimit.update chunk.length
but .length is incorrect for either type: Blob uses .size and
ArrayBuffer uses .byteLength. It worked anyway, because
DummyRateLimit.update doesn't actually look at its argument.

We were already setting binaryType="arraybuffer" for WebSocket
connections.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a local variable reference in BucketRateLimit.when.</title>
<updated>2018-12-05T00:14:35+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-05T00:00:56+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=5817c257c1568c403a41e108d195b209e4e5f589'/>
<id>5817c257c1568c403a41e108d195b209e4e5f589</id>
<content type='text'>
ReferenceError: age is not defined	snowflake.js:265:7
        BucketRateLimit.prototype.when	snowflake/proxy/build/snowflake.js:265:7
        ProxyPair.prototype.flush	snowflake/proxy/build/snowflake.js:558:63
        bind/&lt;	snowflake/proxy/build/snowflake.js:10:56
        ProxyPair.prototype.onClientToRelayMessage	snowflake/proxy/build/snowflake.js:495:14
        bind/&lt;	snowflake/proxy/build/snowflake.js:10:56
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ReferenceError: age is not defined	snowflake.js:265:7
        BucketRateLimit.prototype.when	snowflake/proxy/build/snowflake.js:265:7
        ProxyPair.prototype.flush	snowflake/proxy/build/snowflake.js:558:63
        bind/&lt;	snowflake/proxy/build/snowflake.js:10:56
        ProxyPair.prototype.onClientToRelayMessage	snowflake/proxy/build/snowflake.js:495:14
        bind/&lt;	snowflake/proxy/build/snowflake.js:10:56
</pre>
</div>
</content>
</entry>
<entry>
<title>'//' is not a CSS comment.</title>
<updated>2018-12-04T22:46:12+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T22:45:07+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=9545be1c9f983d1136d789c1761ff58955b22367'/>
<id>9545be1c9f983d1136d789c1761ff58955b22367</id>
<content type='text'>
I got the warning:
	Expected declaration but found ‘/’.  Skipped to next declaration.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I got the warning:
	Expected declaration but found ‘/’.  Skipped to next declaration.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix the ProxyPair tests exposed by the previous commit.</title>
<updated>2018-12-04T22:09:53+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T22:07:42+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=3cd8519ec94198181803345260be9fd20d0de324'/>
<id>3cd8519ec94198181803345260be9fd20d0de324</id>
<content type='text'>
This was mainly a matter of more complete mocking.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This was mainly a matter of more complete mocking.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix nested Jasmine tests.</title>
<updated>2018-12-04T22:09:53+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T20:35:48+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=fce32bf292b24467e4e8286e557f5ec64f77b3b8'/>
<id>fce32bf292b24467e4e8286e557f5ec64f77b3b8</id>
<content type='text'>
You can nest a "describe" in a "describe":
  describe
    describe
      it

But you can't nest an "it" in an "it":
  describe
    it
      it

The nested "it"s were not getting run (or getting run, but their output
ignored, I'm not sure).

Before this change:
	41 specs, 0 failures
After:
	44 specs, 5 failures
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
You can nest a "describe" in a "describe":
  describe
    describe
      it

But you can't nest an "it" in an "it":
  describe
    it
      it

The nested "it"s were not getting run (or getting run, but their output
ignored, I'm not sure).

Before this change:
	41 specs, 0 failures
After:
	44 specs, 5 failures
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove duplicate ProxyPair tests from util.spec.coffee.</title>
<updated>2018-12-04T22:09:53+00:00</updated>
<author>
<name>David Fifield</name>
<email>david@bamsoftware.com</email>
</author>
<published>2018-12-04T20:37:51+00:00</published>
<link rel='alternate' type='text/html' href='https://gitweb.torproject.org/user/dcf/snowflake.git/commit/?id=261ef8f5bc26a35219bb1206968843d8e53b4254'/>
<id>261ef8f5bc26a35219bb1206968843d8e53b4254</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
