mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
Added SO_REUSEPORT socket option for UDP recv ports (#3237)
* Added SO_REUSEPORT socket option for UDP multicast recv ports
This commit is contained in:
parent
50dbd80c51
commit
d8f3b283f8
@ -206,10 +206,21 @@ void zmq::udp_engine_t::plug (io_thread_t *io_thread_, session_base_t *session_)
|
||||
bool multicast = udp_addr->is_mcast ();
|
||||
|
||||
if (multicast) {
|
||||
// Multicast addresses should be allowed to bind to more than
|
||||
// one port as all ports should receive the message
|
||||
#ifdef SO_REUSEPORT
|
||||
rc = setsockopt (_fd, SOL_SOCKET, SO_REUSEPORT,
|
||||
reinterpret_cast<char *> (&on), sizeof (on));
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
#else
|
||||
errno_assert (rc == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// In multicast we should bind ANY and use the mreq struct to
|
||||
// specify the interface
|
||||
any.set_port (bind_addr->port ());
|
||||
|
||||
real_bind_addr = &any;
|
||||
} else {
|
||||
real_bind_addr = bind_addr;
|
||||
|
Loading…
Reference in New Issue
Block a user