mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-03 03:45:43 +08:00
Merge branch 'master' of https://github.com/zeromq/libzmq
This commit is contained in:
commit
97cfa64d93
@ -181,8 +181,7 @@ int zmq::signaler_t::wait (int timeout_)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
if (unlikely(pid != getpid()))
|
if (unlikely(pid != getpid())) {
|
||||||
{
|
|
||||||
// we have forked and the file descriptor is closed. Emulate an interupt
|
// we have forked and the file descriptor is closed. Emulate an interupt
|
||||||
// response.
|
// response.
|
||||||
//printf("Child process %d signaler_t::wait returning simulating interrupt #2\n", getpid());
|
//printf("Child process %d signaler_t::wait returning simulating interrupt #2\n", getpid());
|
||||||
@ -263,23 +262,10 @@ void zmq::signaler_t::recv ()
|
|||||||
#ifdef HAVE_FORK
|
#ifdef HAVE_FORK
|
||||||
void zmq::signaler_t::forked()
|
void zmq::signaler_t::forked()
|
||||||
{
|
{
|
||||||
int oldr = r;
|
// Close file descriptors created in the parent and create new pair
|
||||||
#if !defined ZMQ_HAVE_EVENTFD
|
close (r);
|
||||||
int oldw = w;
|
close (w);
|
||||||
#endif
|
|
||||||
|
|
||||||
// replace the file descriptors created in the parent with new
|
|
||||||
// ones, and close the inherited ones
|
|
||||||
make_fdpair (&r, &w);
|
make_fdpair (&r, &w);
|
||||||
#if defined ZMQ_HAVE_EVENTFD
|
|
||||||
int rc = close (oldr);
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
#else
|
|
||||||
int rc = close (oldw);
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
rc = close (oldr);
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -422,16 +408,9 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
|||||||
// Cleanup writer if connection failed
|
// Cleanup writer if connection failed
|
||||||
rc = closesocket (*w_);
|
rc = closesocket (*w_);
|
||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
|
|
||||||
*w_ = INVALID_SOCKET;
|
*w_ = INVALID_SOCKET;
|
||||||
|
|
||||||
// Set errno from saved value
|
// Set errno from saved value
|
||||||
errno = wsa_error_to_errno (conn_errno);
|
errno = wsa_error_to_errno (conn_errno);
|
||||||
|
|
||||||
// Ideally, we would return errno to the caller signaler_t()
|
|
||||||
// Unfortunately, it uses errno_assert() which gives "Unknown error"
|
|
||||||
// We might as well assert here and print the actual error message
|
|
||||||
wsa_assert_no (conn_errno);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user