Avoid busy loop after retrieve returns zero size

The retrieve thunk can return zero size if the server closes
connection normally.  We need to finish loop in that case, too.

It might be useful if we distinguish error case and normal
termination case; possible future extension.