mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-07 05:58:45 +01:00
Ported from libxs revision 123c0f5387ecef287dd11f4dc790fb76ee1c0f67
Handle insufficient resources on accept() decently
If accept() call fails due to insuffient OS resources
the new connection is rejected.
This commit is contained in:
@@ -190,12 +190,14 @@ int zmq::ipc_listener_t::close ()
|
||||
zmq::fd_t zmq::ipc_listener_t::accept ()
|
||||
{
|
||||
// Accept one connection and deal with different failure modes.
|
||||
// The situation where connection cannot be accepted due to insufficient
|
||||
// resources is considered valid and treated by ignoring the connection.
|
||||
zmq_assert (s != retired_fd);
|
||||
fd_t sock = ::accept (s, NULL, NULL);
|
||||
if (sock == -1) {
|
||||
errno_assert (errno == EAGAIN || errno == EWOULDBLOCK ||
|
||||
errno == EINTR || errno == ECONNABORTED || errno == EPROTO ||
|
||||
errno == ENOBUFS);
|
||||
errno == ENFILE);
|
||||
return retired_fd;
|
||||
}
|
||||
return sock;
|
||||
|
||||
Reference in New Issue
Block a user