mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 10:57:34 +08:00
use acl_socket_alive as the new method for checking the socket's aliving status.
This commit is contained in:
parent
c0c1b22e69
commit
3217e70bb5
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user