We've not actually hit this bug in practice, but at least in
theory while checking for cancellation we could read > 0 but
fewer than 4 bytes, which would effectively be discarded and
we would lose synchronization.
Note the socket is non-blocking.
Change the code so that we temporarily set the socket back to
blocking and force the read of all 4 bytes.