Process data until buffer exhausted.

In theory, multiple messages could arrive in a single _write. This
wraps the logic in an infinite loop, and terminates only when we cannot
process any further.