Commit 52e49adc authored by thorsten's avatar thorsten
Browse files

*Added proper destructor

parent 9a5f55d5
......@@ -94,6 +94,7 @@ relay_peer_destroy (relay_peer_t **self_p)
// Free class properties here
relay_peer_disconnect(*self_p);
zuuid_destroy(&self->uuid);
zhashx_destroy(&self->my_handles);
// Free object itself
free (self);
*self_p = NULL;
......@@ -113,7 +114,8 @@ relay_peer_receive(relay_peer_t *self, rmq_msg_t *msg)
zuuid_t* uuid = rmq_msg_sender_id(msg) ? rmq_msg_sender_id(msg) : self->uuid;
assert(uuid);
relay_handle_t *handle = (relay_handle_t *)zhashx_lookup(self->handles, zuuid_str(uuid));
relay_handle_t *handle = (relay_handle_t *)
zhashx_lookup(self->handles, zuuid_str(uuid));
if(handle == NULL){
if(self->verbose)
......@@ -131,13 +133,15 @@ relay_peer_receive(relay_peer_t *self, rmq_msg_t *msg)
}
assert(handle);
}
/*
if(rmq_msg_id(msg) == RMQ_MSG_GREETING || rmq_msg_id(msg) == RMQ_MSG_ACCEPTED)
{
self->want_sequence = 0; //Reset connection
}
*/
++self->want_sequence;
// The sequence number set by the peer, and our own calculated
// sequence number should be the same.
if(self->verbose)
......
......@@ -387,6 +387,8 @@ relay_target_send(relay_target_t *self, zuuid_t *sender, zmsg_t **msg_p)
rmq_msg_set_corr_id (msg, (uint16_t) rand());
rmq_msg_set_sequence (msg, (uint16_t) relay_peer_next_sequence(self->peer));
rmq_msg_set_sender_id(msg, sender);
rmq_msg_set_receiver_id (msg, relay_peer_uuid(self->peer));
rmq_msg_set_sender_pk(msg, relay_handle_pk(self->handle));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment