Merge pull request #121 from plieven/fix_recv

socket: handle count == 0 in rpc_read_from_socket
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2015-08-04 16:12:43 -07:00
commit e466dc6b03
1 changed files with 6 additions and 0 deletions

View File

@ -249,6 +249,12 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
rpc_set_error(rpc, "Read from socket failed, errno:%d. Closing socket.", errno);
return -1;
}
if (count == 0) {
/* remote side has closed the socket. Reconnect. */
return -1;
}
rpc->inpos += count;
while (rpc->inpos >= 4) {