check poll result for POLLHUP and POLLERR
parent
bb33b2e09f
commit
d54007f79b
|
|
@ -177,11 +177,11 @@ int tcprecvdata_ex(int sock, void *data, const int size, \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
res = poll(&pollfds, 1, 1000 * timeout);
|
res = poll(&pollfds, 1, 1000 * timeout);
|
||||||
if (pollfds.revents & POLLHUP)
|
if (res > 0 && (pollfds.revents & (POLLHUP | POLLERR)))
|
||||||
{
|
{
|
||||||
ret_code = ENOTCONN;
|
ret_code = ENOTCONN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
|
|
@ -265,7 +265,7 @@ int tcpsenddata(int sock, void* data, const int size, const int timeout)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
result = poll(&pollfds, 1, 1000 * timeout);
|
result = poll(&pollfds, 1, 1000 * timeout);
|
||||||
if (pollfds.revents & POLLHUP)
|
if (result > 0 && (pollfds.revents & (POLLHUP | POLLERR)))
|
||||||
{
|
{
|
||||||
return ENOTCONN;
|
return ENOTCONN;
|
||||||
}
|
}
|
||||||
|
|
@ -371,7 +371,7 @@ int tcprecvdata_nb_ms(int sock, void *data, const int size, \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
res = poll(&pollfds, 1, timeout_ms);
|
res = poll(&pollfds, 1, timeout_ms);
|
||||||
if (pollfds.revents & POLLHUP)
|
if (res > 0 && (pollfds.revents & (POLLHUP | POLLERR)))
|
||||||
{
|
{
|
||||||
ret_code = ENOTCONN;
|
ret_code = ENOTCONN;
|
||||||
break;
|
break;
|
||||||
|
|
@ -455,7 +455,7 @@ int tcpsenddata_nb(int sock, void* data, const int size, const int timeout)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
result = poll(&pollfds, 1, 1000 * timeout);
|
result = poll(&pollfds, 1, 1000 * timeout);
|
||||||
if (pollfds.revents & POLLHUP)
|
if (result > 0 && (pollfds.revents & (POLLHUP | POLLERR)))
|
||||||
{
|
{
|
||||||
return ENOTCONN;
|
return ENOTCONN;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue