Process multiple packets per tick

Before this change we would process at most one gearman packet per tick.
This meant that if we got more than one packet in a single socket read
per tick we would slowly build up a large buffer of un-read packets
(@remainder in the code). This caused problems as we started to run out
of memory and get buffer too large errors.

To solve this problem we loop and process all the packets we can in one
go.