use acl_socket_alive as the new method for checking the socket's aliving status.

This commit is contained in:
zsx 2018-09-29 11:30:42 +08:00
parent c0c1b22e69
commit 3217e70bb5
2 changed files with 11 additions and 6 deletions

View File

@ -39,7 +39,6 @@ static acl_poll_fn __sys_poll = poll;
int acl_readable(ACL_SOCKET fd)
{
const char *myname = "poll_read_wait";
struct pollfd fds;
int delay = 0;
@ -59,7 +58,7 @@ int acl_readable(ACL_SOCKET fd)
continue;
acl_msg_error("%s(%d), %s: poll error(%s), fd: %d",
__FILE__, __LINE__, myname,
__FILE__, __LINE__, __FUNCTION__,
acl_last_serror(), (int) fd);
return -1;
case 0:
@ -80,7 +79,6 @@ int acl_readable(ACL_SOCKET fd)
int acl_readable(ACL_SOCKET fd)
{
const char *myname = "acl_readable";
struct timeval tv;
fd_set rfds, xfds;
int errnum;
@ -90,7 +88,7 @@ int acl_readable(ACL_SOCKET fd)
*/
if ((unsigned) fd >= FD_SETSIZE)
acl_msg_fatal("%s(%d), %s: fd %d does not fit in "
"FD_SETSIZE: %d", __FILE__, __LINE__, myname,
"FD_SETSIZE: %d", __FILE__, __LINE__, __FUNCTION__,
(int) fd, FD_SETSIZE);
/*
@ -126,7 +124,7 @@ int acl_readable(ACL_SOCKET fd)
continue;
#endif
acl_msg_error("%s(%d), %s: select error(%s), fd: %d",
__FILE__, __LINE__, myname,
__FILE__, __LINE__, __FUNCTION__,
acl_last_serror(), (int) fd);
return -1;
case 0:

View File

@ -269,7 +269,14 @@ bool socket_stream::alive(void) const
{
if (stream_ == NULL)
return false;
#if 0
if (acl_vstream_probe_status(stream_) == 0)
return true;
else
return false;
#else
return acl_socket_alive(ACL_VSTREAM_SOCK(stream_)) ? true : false;
#endif
}
socket_stream& socket_stream::set_tcp_nodelay(bool on)