Fix store of big items

There was a bug in the return codes from the IO layer causing it
to return 0 instead of -1 if there wasn't space in the output
buffer. This caused libcouchbase to loop forever trying to send
the data.

Change-Id: Iadbec8188cf40984c0c9a893fe285206dd484828
Reviewed-on: http://review.couchbase.org/24078
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Merge remote branch 'couchbase/master' into gogiigo