Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Code cleanup #464

Merged
merged 3 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
12 src/dealer.cpp
@@ -35,8 +35,6 @@ zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
// be noone to receive the replies anyway.
// options.delay_on_close = false;
- options.recv_identity = true;
-
prefetched_msg.init ();
}
@@ -73,15 +71,7 @@ int zmq::dealer_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
- // DEALER socket doesn't use identities. We can safely drop it and
- while (true) {
- int rc = fq.recv (msg_);
- if (rc != 0)
- return rc;
- if (likely (!(msg_->flags () & msg_t::identity)))
- break;
- }
- return 0;
+ return fq.recv (msg_);
}
bool zmq::dealer_t::xhas_in ()
View
2  src/options.cpp
@@ -49,13 +49,13 @@ zmq::options_t::options_t () :
delay_on_disconnect (true),
filter (false),
recv_identity (false),
+ raw_sock (false),
tcp_keepalive (-1),
tcp_keepalive_cnt (-1),
tcp_keepalive_idle (-1),
tcp_keepalive_intvl (-1),
socket_id (0)
{
- raw_sock = false;
}
int zmq::options_t::setsockopt (int option_, const void *optval_,
View
1  src/req.cpp
@@ -147,7 +147,6 @@ zmq::req_session_t::req_session_t (io_thread_t *io_thread_, bool connect_,
zmq::req_session_t::~req_session_t ()
{
- state = options.recv_identity ? identity : bottom;
}
int zmq::req_session_t::push_msg (msg_t *msg_)
View
2  src/session_base.cpp
@@ -20,8 +20,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdarg.h>
-
#include "session_base.hpp"
#include "i_engine.hpp"
#include "err.hpp"
View
34 src/socket_base.cpp
@@ -428,15 +428,11 @@ int zmq::socket_base_t::connect (const char *addr_)
// The total HWM for an inproc connection should be the sum of
// the binder's HWM and the connector's HWM.
- int sndhwm;
- int rcvhwm;
- if (options.sndhwm == 0 || peer.options.rcvhwm == 0)
- sndhwm = 0;
- else
+ int sndhwm = 0;
+ if (options.sndhwm != 0 && peer.options.rcvhwm != 0)
sndhwm = options.sndhwm + peer.options.rcvhwm;
- if (options.rcvhwm == 0 || peer.options.sndhwm == 0)
- rcvhwm = 0;
- else
+ int rcvhwm = 0;
+ if (options.rcvhwm != 0 && peer.options.sndhwm != 0)
rcvhwm = options.rcvhwm + peer.options.sndhwm;
// Create a bi-directional pipe to connect the peers.
@@ -1034,7 +1030,7 @@ int zmq::socket_base_t::monitor (const char *addr_, int events_)
// Register events to monitor
monitor_events = events_;
- monitor_socket = zmq_socket( get_ctx (), ZMQ_PAIR);
+ monitor_socket = zmq_socket (get_ctx (), ZMQ_PAIR);
if (monitor_socket == NULL)
return -1;
@@ -1056,7 +1052,7 @@ void zmq::socket_base_t::event_connected (const char *addr_, int fd_)
if (monitor_events & ZMQ_EVENT_CONNECTED) {
zmq_event_t event;
event.event = ZMQ_EVENT_CONNECTED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.connected.fd = fd_;
monitor_event (event);
}
@@ -1067,7 +1063,7 @@ void zmq::socket_base_t::event_connect_delayed (const char *addr_, int err_)
if (monitor_events & ZMQ_EVENT_CONNECT_DELAYED) {
zmq_event_t event;
event.event = ZMQ_EVENT_CONNECT_DELAYED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.connect_delayed.err = err_;
monitor_event (event);
}
@@ -1078,7 +1074,7 @@ void zmq::socket_base_t::event_connect_retried (const char *addr_, int interval_
if (monitor_events & ZMQ_EVENT_CONNECT_RETRIED) {
zmq_event_t event;
event.event = ZMQ_EVENT_CONNECT_RETRIED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.connect_retried.interval = interval_;
monitor_event (event);
}
@@ -1089,7 +1085,7 @@ void zmq::socket_base_t::event_listening (const char *addr_, int fd_)
if (monitor_events & ZMQ_EVENT_LISTENING) {
zmq_event_t event;
event.event = ZMQ_EVENT_LISTENING;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.listening.fd = fd_;
monitor_event (event);
}
@@ -1100,7 +1096,7 @@ void zmq::socket_base_t::event_bind_failed (const char *addr_, int err_)
if (monitor_events & ZMQ_EVENT_BIND_FAILED) {
zmq_event_t event;
event.event = ZMQ_EVENT_BIND_FAILED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.bind_failed.err = err_;
monitor_event (event);
}
@@ -1111,7 +1107,7 @@ void zmq::socket_base_t::event_accepted (const char *addr_, int fd_)
if (monitor_events & ZMQ_EVENT_ACCEPTED) {
zmq_event_t event;
event.event = ZMQ_EVENT_ACCEPTED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.accepted.fd = fd_;
monitor_event (event);
}
@@ -1122,7 +1118,7 @@ void zmq::socket_base_t::event_accept_failed (const char *addr_, int err_)
if (monitor_events & ZMQ_EVENT_ACCEPT_FAILED) {
zmq_event_t event;
event.event = ZMQ_EVENT_ACCEPT_FAILED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.accept_failed.err= err_;
monitor_event (event);
}
@@ -1133,7 +1129,7 @@ void zmq::socket_base_t::event_closed (const char *addr_, int fd_)
if (monitor_events & ZMQ_EVENT_CLOSED) {
zmq_event_t event;
event.event = ZMQ_EVENT_CLOSED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.closed.fd = fd_;
monitor_event (event);
}
@@ -1144,7 +1140,7 @@ void zmq::socket_base_t::event_close_failed (const char *addr_, int err_)
if (monitor_events & ZMQ_EVENT_CLOSE_FAILED) {
zmq_event_t event;
event.event = ZMQ_EVENT_CLOSE_FAILED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.close_failed.err = err_;
monitor_event (event);
}
@@ -1155,7 +1151,7 @@ void zmq::socket_base_t::event_disconnected (const char *addr_, int fd_)
if (monitor_events & ZMQ_EVENT_DISCONNECTED) {
zmq_event_t event;
event.event = ZMQ_EVENT_DISCONNECTED;
- event.data.connected.addr = (char *) addr_;
+ event.data.connected.addr = const_cast <char *> (addr_);
event.data.disconnected.fd = fd_;
monitor_event (event);
}
Something went wrong with that request. Please try again.