From dce17292e1f62ca692aa36ed3eaf5bfb09e7ab69 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sat, 21 Apr 2012 19:36:35 +0200 Subject: 'own' command replaced by synchronous call The commands was a vestige of the removed 'durable sockets' feature Signed-off-by: Martin Sustrik --- src/command.hpp | 6 ------ src/object.cpp | 23 ----------------------- src/object.hpp | 3 --- src/own.cpp | 26 ++++++++++---------------- src/own.hpp | 1 - 5 files changed, 10 insertions(+), 49 deletions(-) diff --git a/src/command.hpp b/src/command.hpp index b99e21f..b7a14c3 100644 --- a/src/command.hpp +++ b/src/command.hpp @@ -44,7 +44,6 @@ namespace xs { stop, plug, - own, attach, bind, activate_read, @@ -71,11 +70,6 @@ namespace xs struct { } plug; - // Sent to socket to let it know about the newly created object. - struct { - xs::own_t *object; - } own; - // Attach the engine to the session. If engine is NULL, it informs // session that the connection have failed. struct { diff --git a/src/object.cpp b/src/object.cpp index 4f04fe4..dac4b6c 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -77,11 +77,6 @@ void xs::object_t::process_command (command_t &cmd_) process_seqnum (); break; - case command_t::own: - process_own (cmd_.args.own.object); - process_seqnum (); - break; - case command_t::attach: process_attach (cmd_.args.attach.engine); process_seqnum (); @@ -186,19 +181,6 @@ void xs::object_t::send_plug (own_t *destination_, bool inc_seqnum_) send_command (cmd); } -void xs::object_t::send_own (own_t *destination_, own_t *object_) -{ - destination_->inc_seqnum (); - command_t cmd; -#if defined XS_MAKE_VALGRIND_HAPPY - memset (&cmd, 0, sizeof (cmd)); -#endif - cmd.destination = destination_; - cmd.type = command_t::own; - cmd.args.own.object = object_; - send_command (cmd); -} - void xs::object_t::send_attach (session_base_t *destination_, i_engine *engine_, bool inc_seqnum_) { @@ -369,11 +351,6 @@ void xs::object_t::process_plug () xs_assert (false); } -void xs::object_t::process_own (own_t *object_) -{ - xs_assert (false); -} - void xs::object_t::process_attach (i_engine *engine_) { xs_assert (false); diff --git a/src/object.hpp b/src/object.hpp index fabb156..b695308 100644 --- a/src/object.hpp +++ b/src/object.hpp @@ -74,8 +74,6 @@ namespace xs void send_stop (); void send_plug (xs::own_t *destination_, bool inc_seqnum_ = true); - void send_own (xs::own_t *destination_, - xs::own_t *object_); void send_attach (xs::session_base_t *destination_, xs::i_engine *engine_, bool inc_seqnum_ = true); void send_bind (xs::own_t *destination_, xs::pipe_t *pipe_, @@ -98,7 +96,6 @@ namespace xs // called when command arrives from another thread. virtual void process_stop (); virtual void process_plug (); - virtual void process_own (xs::own_t *object_); virtual void process_attach (xs::i_engine *engine_); virtual void process_bind (xs::pipe_t *pipe_); virtual void process_activate_read (); diff --git a/src/own.cpp b/src/own.cpp index 968d272..45f1cbf 100644 --- a/src/own.cpp +++ b/src/own.cpp @@ -76,8 +76,16 @@ void xs::own_t::launch_child (own_t *object_) // Plug the object into the I/O thread. send_plug (object_); - // Take ownership of the object. - send_own (this, object_); + // If the object is already being shut down, new owned objects are + // immediately asked to terminate. Note that linger is set to zero. + if (terminating) { + register_term_acks (1); + send_term (object_, 0); + return; + } + + // Store the reference to the owned object. + owned.insert (object_); } void xs::own_t::process_term_req (own_t *object_) @@ -103,20 +111,6 @@ void xs::own_t::process_term_req (own_t *object_) send_term (object_, options.linger); } -void xs::own_t::process_own (own_t *object_) -{ - // If the object is already being shut down, new owned objects are - // immediately asked to terminate. Note that linger is set to zero. - if (terminating) { - register_term_acks (1); - send_term (object_, 0); - return; - } - - // Store the reference to the owned object. - owned.insert (object_); -} - void xs::own_t::terminate () { // If termination is already underway, there's no point diff --git a/src/own.hpp b/src/own.hpp index 2d47a39..5c0e438 100644 --- a/src/own.hpp +++ b/src/own.hpp @@ -68,7 +68,6 @@ namespace xs protected: // Handlers for incoming commands. - void process_own (own_t *object_); void process_term_req (own_t *object_); void process_term_ack (); void process_seqnum (); -- cgit v1.2.3