Problem: ZMQ_BINDTODEVICE not used for ZMQ_DISH

Solution: apply the option outside of the send/recv_enabled blocks so
that it is used for all types of UDP sockets
This commit is contained in:
Luca Boccassi
2017-07-31 16:03:55 +01:00
parent 415bdbc1b9
commit bb0b518e7f

View File

@@ -101,6 +101,10 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_)
io_object_t::plug (io_thread_); io_object_t::plug (io_thread_);
handle = add_fd (fd); handle = add_fd (fd);
// Bind the socket to a device if applicable
if (!options.bound_device.empty ())
bind_to_device (fd, options.bound_device);
if (send_enabled) { if (send_enabled) {
if (!options.raw_socket) { if (!options.raw_socket) {
out_address = address->resolved.udp_addr->dest_addr (); out_address = address->resolved.udp_addr->dest_addr ();
@@ -123,10 +127,6 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_)
errno_assert (rc == 0); errno_assert (rc == 0);
#endif #endif
// Bind the socket to a device if applicable
if (!options.bound_device.empty ())
bind_to_device (fd, options.bound_device);
rc = bind (fd, address->resolved.udp_addr->bind_addr (), rc = bind (fd, address->resolved.udp_addr->bind_addr (),
address->resolved.udp_addr->bind_addrlen ()); address->resolved.udp_addr->bind_addrlen ());
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS