summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-12-01 18:50:54 +0100
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-12-01 18:50:54 +0100
commit9bd309bda6522dfdd514dd0c4edae04322c83ed1 (patch)
treeffcb1f097b219f64cffb079e1e36a54d2f624e8b
parentc04583ff6ca3c27de5628a61b6b6ce59fd13c9d9 (diff)
annoying optimisation in 'bind' command removed
-rw-r--r--src/command.hpp4
-rw-r--r--src/object.cpp11
-rw-r--r--src/object.hpp6
-rw-r--r--src/session.cpp5
-rw-r--r--src/socket_base.cpp13
-rw-r--r--src/socket_base.hpp3
6 files changed, 14 insertions, 28 deletions
diff --git a/src/command.hpp b/src/command.hpp
index 3099852..8aa7c56 100644
--- a/src/command.hpp
+++ b/src/command.hpp
@@ -69,12 +69,10 @@ namespace zmq
} attach;
// Sent from session to socket to establish pipe(s) between them.
- // If adjust_seqnum is true, caller have used inc_seqnum beforehand
- // and thus the callee should take care of catching up.
+ // Caller have used inc_seqnum beforehand sending the command.
struct {
class reader_t *in_pipe;
class writer_t *out_pipe;
- bool adjust_seqnum;
} bind;
// Sent by pipe writer to inform dormant pipe reader that there
diff --git a/src/object.cpp b/src/object.cpp
index b5d5eee..fda7b03 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -83,8 +83,7 @@ void zmq::object_t::process_command (command_t &cmd_)
return;
case command_t::bind:
- process_bind (cmd_.args.bind.in_pipe, cmd_.args.bind.out_pipe,
- cmd_.args.bind.adjust_seqnum);
+ process_bind (cmd_.args.bind.in_pipe, cmd_.args.bind.out_pipe);
return;
case command_t::pipe_term:
@@ -183,15 +182,14 @@ void zmq::object_t::send_attach (session_t *destination_, i_engine *engine_)
send_command (cmd);
}
-void zmq::object_t::send_bind (object_t *destination_,
- reader_t *in_pipe_, writer_t *out_pipe_, bool adjust_seqnum_)
+void zmq::object_t::send_bind (socket_base_t *destination_,
+ reader_t *in_pipe_, writer_t *out_pipe_)
{
command_t cmd;
cmd.destination = destination_;
cmd.type = command_t::bind;
cmd.args.bind.in_pipe = in_pipe_;
cmd.args.bind.out_pipe = out_pipe_;
- cmd.args.bind.adjust_seqnum = adjust_seqnum_;
send_command (cmd);
}
@@ -265,8 +263,7 @@ void zmq::object_t::process_attach (i_engine *engine_)
zmq_assert (false);
}
-void zmq::object_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_,
- bool adjust_seqnum_)
+void zmq::object_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_)
{
zmq_assert (false);
}
diff --git a/src/object.hpp b/src/object.hpp
index 4fd0a8e..9d4cd9a 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -68,8 +68,8 @@ namespace zmq
class owned_t *object_);
void send_attach (class session_t *destination_,
struct i_engine *engine_);
- void send_bind (object_t *destination_, class reader_t *in_pipe_,
- class writer_t *out_pipe_, bool adjust_seqnum_);
+ void send_bind (class socket_base_t *destination_,
+ class reader_t *in_pipe_, class writer_t *out_pipe_);
void send_revive (class object_t *destination_);
void send_pipe_term (class writer_t *destination_);
void send_pipe_term_ack (class reader_t *destination_);
@@ -85,7 +85,7 @@ namespace zmq
virtual void process_own (class owned_t *object_);
virtual void process_attach (struct i_engine *engine_);
virtual void process_bind (class reader_t *in_pipe_,
- class writer_t *out_pipe_, bool adjust_seqnum_);
+ class writer_t *out_pipe_);
virtual void process_revive ();
virtual void process_pipe_term ();
virtual void process_pipe_term_ack ();
diff --git a/src/session.cpp b/src/session.cpp
index 87b47b0..5290d6b 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -151,10 +151,9 @@ void zmq::session_t::process_plug ()
out_pipe->set_endpoint (this);
}
- // Note that initial call to inc_seqnum was optimised out. Last
- // parameter conveys the fact to the callee.
+ owner->inc_seqnum ();
send_bind (owner, outbound ? &outbound->reader : NULL,
- inbound ? &inbound->writer : NULL, false);
+ inbound ? &inbound->writer : NULL);
}
owned_t::process_plug ();
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index a614759..6a972e4 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -161,7 +161,7 @@ int zmq::socket_base_t::connect (const char *addr_)
// was incremented in find_endpoint function. The callee is notified
// about the fact via the last parameter.
send_bind (peer, out_pipe ? &out_pipe->reader : NULL,
- in_pipe ? &in_pipe->writer : NULL, true);
+ in_pipe ? &in_pipe->writer : NULL);
return 0;
}
@@ -509,16 +509,9 @@ void zmq::socket_base_t::process_own (owned_t *object_)
io_objects.insert (object_);
}
-void zmq::socket_base_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_,
- bool adjust_seqnum_)
+void zmq::socket_base_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_)
{
- // In case of inproc transport, the seqnum should catch up here.
- // For other transports the seqnum modification can be optimised out
- // because final handshaking between the socket and the session ensures
- // that no 'bind' command will be left unprocessed.
- if (adjust_seqnum_)
- processed_seqnum++;
-
+ processed_seqnum++;
attach_pipes (in_pipe_, out_pipe_);
}
diff --git a/src/socket_base.hpp b/src/socket_base.hpp
index dd7b526..c766bda 100644
--- a/src/socket_base.hpp
+++ b/src/socket_base.hpp
@@ -114,8 +114,7 @@ namespace zmq
// Handlers for incoming commands.
void process_own (class owned_t *object_);
- void process_bind (class reader_t *in_pipe_, class writer_t *out_pipe_,
- bool adjust_seqnum_);
+ void process_bind (class reader_t *in_pipe_, class writer_t *out_pipe_);
void process_term_req (class owned_t *object_);
void process_term_ack ();