MB-10877 re-jig provide_batch loop and error checking

Make sure caller won't ignore any possible socket error and wrongly
return a false status value.

Change-Id: Icf532d41dab2f4d5aa3f7a0f32a00114210e11b0
Reviewed-on: http://review.couchbase.org/35936
Reviewed-by: Jim Walker <jim@couchbase.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>