BufferedReader: return the total data we have, including the new input

Previously we forgot to include the just-read data in the calculation.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
PackerReader: when reading the header we may get the payload too

We shouldn't emit 2 reads since the first read may well have read
all the data there is.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Userspace: when we read into our buffer, don't overwrite unread data

We shuffle data around in the 'advance' function ensuring the 0th
byte in the array is the first byte we should send the client.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Userspace: buffer more than 1 * max_packet_length

The buffering code expects to be able to read more than 1 * max_packet_length.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Merge pull request #6 from djs55/fix-buffering

Fix buffering