summaryrefslogtreecommitdiff
path: root/src/object.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-13 14:07:30 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-13 14:07:30 +0100
commitf5ce81f2893ec0707c2f4346740878e68b51e13a (patch)
tree88e0a375594c06879b62668a81a2e2250c23a2ac /src/object.cpp
parentcdc2efe9b5f0d1f45065b1c32e5eabd7e9f78a12 (diff)
Multi-hop REQ/REP, part VIII., new blob_t type used for holding identity
Diffstat (limited to 'src/object.cpp')
-rw-r--r--src/object.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/object.cpp b/src/object.cpp
index 73a17a3..eaa67c9 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -83,8 +83,8 @@ void zmq::object_t::process_command (command_t &cmd_)
case command_t::attach:
process_attach (cmd_.args.attach.engine,
- cmd_.args.attach.peer_identity_size,
- cmd_.args.attach.peer_identity);
+ blob_t (cmd_.args.attach.peer_identity,
+ cmd_.args.attach.peer_identity_size));
process_seqnum ();
break;
@@ -184,8 +184,7 @@ void zmq::object_t::send_own (socket_base_t *destination_, owned_t *object_)
}
void zmq::object_t::send_attach (session_t *destination_, i_engine *engine_,
- unsigned char peer_identity_size_, unsigned char *peer_identity_,
- bool inc_seqnum_)
+ const blob_t &peer_identity_, bool inc_seqnum_)
{
if (inc_seqnum_)
destination_->inc_seqnum ();
@@ -194,17 +193,17 @@ void zmq::object_t::send_attach (session_t *destination_, i_engine *engine_,
cmd.destination = destination_;
cmd.type = command_t::attach;
cmd.args.attach.engine = engine_;
- if (!peer_identity_size_) {
+ if (peer_identity_.empty ()) {
cmd.args.attach.peer_identity_size = 0;
cmd.args.attach.peer_identity = NULL;
}
else {
- cmd.args.attach.peer_identity_size = peer_identity_size_;
+ cmd.args.attach.peer_identity_size = peer_identity_.size ();
cmd.args.attach.peer_identity =
- (unsigned char*) malloc (peer_identity_size_);
+ (unsigned char*) malloc (peer_identity_.size ());
zmq_assert (cmd.args.attach.peer_identity_size);
- memcpy (cmd.args.attach.peer_identity, peer_identity_,
- peer_identity_size_);
+ memcpy (cmd.args.attach.peer_identity, peer_identity_.data (),
+ peer_identity_.size ());
}
send_command (cmd);
}
@@ -289,7 +288,7 @@ void zmq::object_t::process_own (owned_t *object_)
}
void zmq::object_t::process_attach (i_engine *engine_,
- unsigned char peer_identity_size_, unsigned char *peer_identity_)
+ const blob_t &peer_identity_)
{
zmq_assert (false);
}