libfreerdp-core/tcp: check for peer disconnection.
This commit is contained in:
parent
5fc87c25cf
commit
9d414132e4
@ -155,12 +155,14 @@ int tcp_read(rdpTcp* tcp, uint8* data, int length)
|
||||
|
||||
status = recv(tcp->sockfd, data, length, 0);
|
||||
|
||||
if (status < 0)
|
||||
if (status <= 0)
|
||||
{
|
||||
/* No data available */
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||
return 0;
|
||||
|
||||
perror("recv");
|
||||
/* When peer disconnects we get status 0 with no error. */
|
||||
if (status < 0)
|
||||
perror("recv");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user