maxogden/multiplex — pull request #11 by substack (2014-08-26 07:01:34+00:00)
Title: handle unexpected chunk boundaries

These changes greatly improve the handling of unexpected chunk boundaries by buffering (up to `opts.maxDepth` frames in the same chunk, default: 100). Unfortunately, these changes also alter the semantics because the assumption that sent chunks are 1:1 with received chunks doesn't hold across network boundaries without extra framing, which is what this module is about in the first place.

The error detection is also now different because before the presence of `[null,buf]` was used from the return value of multibuffer.readPartial()`, but that state only indicates that the required number of bytes haven't been read yet. Instead of being used for errors, this status is now used for buffering.

If merged, this pull request should bump the major version.