maxogden/multiplex — pull request #8 by substack (2014-06-30 00:40:52+00:00)
Title: multiple buffers in a single chunk

Often over network connections the buffer chunks won't be 1:1 with messages because the network card and operating system slice and dice the packet chunk sizes over the network. The manifestation of this I was hitting was that multiple chunks were getting concatenated together into a single chunk, which confused the parser. The only way I could reliably duplicate the issue was with an actual tcp server in the tests.

To fix this bug, I added a loop to recursively process the leftover chunks in each message.