cloudant/couch_replicator — pull request #3 by kocolosk (2012-07-20 23:31:06+00:00)
Title: Consume all ibrowse messages before stream_next

The flow control in ibrowse's async response streams is tricky. We call stream_next to pull more data off the socket, but it seems that ibrowse will sometimes split that data into multiple messages. If we call stream_next for each message we process we end up with an overflowing mailbox.

This patch changes the consumer so that it clears out the mailbox before calling stream_next.

BugzID: 14024