15 Commits
Author SHA1 Message Date
James Coglan d8d38e54e6 Catch synchronous errors thrown by extensions. 2017-09-08 21:18:07 +01:00
James Coglan fb84d36546 Fix a couple of race conditions in Pipeline.
While improving error handling, I found two situations where Pipeline
fails to close() correctly because it believes there are more messages
to emit.

The first is fixed by the change to `Cell.pending()`. If another message
is pushed into the pipeline after one of the cells has stopped, all the
cells get their pending count bumped. However, this new message will
never enter the queue inside the stopped cell, so its pending count will
never reach zero. So, we only increment the pending count for cells that
are not stopped.

The second is fixed by the change to `Functor._flushQueue()`. Say a cell
processes two messages in turn, M1 and M2. Both begin being processed
before either returns a result. M1 generates an error, while processing
of M2 never completes. In this situation, the error should indicate the
end of the stream but because M2 never completes, the pending count
never reaches zero. So, if we see a record with an error, we should
truncate the queue and this point and set pending=0 so the functor is
considered complete.
2017-09-08 20:59:13 +01:00
James Coglan 36cc2c5c73 Correct a spelling error in the spec. 2017-09-02 12:18:05 +01:00
James Coglan c8f31cc1c7 Reversing the previous commit; generateResponse() should throw on invalid heders (as should activate()), because the server should fail the connection in this event. 2015-03-26 08:30:23 +00:00
James Coglan 62ac506b80 If the header from the client is invalid, just ignore it and build a pipeline with no sessions. 2015-03-14 12:56:41 +00:00
James Coglan 1b77290e82 Put a structure in place to preserve ordering of messages and errors, and defer closing of sessions while messages are still in the pipeline.
This is designed to address these issues:

* https://github.com/faye/permessage-deflate-node/issues/1
* https://github.com/faye/permessage-deflate-node/pull/3
* https://github.com/faye/websocket-driver-node/issues/11
2015-02-15 13:14:22 +00:00
James Coglan 007cc0ac22 Prefix extension error messages with the name of the extension. 2014-12-08 00:54:03 +00:00
James Coglan a28cdfdb1a Make sure every session processes messages in both directions in the same order the messages arrive at the driver. 2014-12-01 22:03:49 +00:00
James Coglan 2b45d787e7 Some fixes discovered while porting to Ruby. 2014-12-01 21:02:08 +00:00
James Coglan 7dfe2520a9 I forgot to add the 'type' field to the extensions in the tests. 2014-11-29 00:54:01 +00:00
James Coglan 9d1a70d845 Wrap an abstraction around the data returned by the parser to facilitate access by name and in order. 2014-11-28 23:11:23 +00:00
James Coglan 6e325ca400 Test that server sessions are created with all the given offers. 2014-11-28 00:18:31 +00:00
James Coglan 71bb6b3274 Flesh out the specs for client and server negotation, and fix the resulting bugs. 2014-11-28 00:14:05 +00:00
James Coglan 123ae175a1 Begin writing tests for the Extensions class. 2014-11-25 23:13:19 +00:00
James Coglan 9332e0eaa3 Add tests for the Parser module. 2014-11-25 22:09:30 +00:00