From: Christian Grothoff Date: Sat, 16 Nov 2013 18:48:40 +0000 (+0000) Subject: -fix missing endianess conversions X-Git-Tag: initial-import-from-subversion-38251~6049 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=942c00a499e9fd77a7573de622d169f362b08abd;p=oweals%2Fgnunet.git -fix missing endianess conversions --- diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 07cb8ac44..2ea3d77cb 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c @@ -332,6 +332,7 @@ start_phone () phone_state = PS_LOOKUP_EGO; return; } + GNUNET_assert (NULL == phone); phone = GNUNET_CONVERSATION_phone_create (cfg, caller_id, &phone_event_handler, NULL); @@ -374,10 +375,9 @@ call_event_handler (void *cls, { case GNUNET_CONVERSATION_EC_CALL_RINGING: GNUNET_break (CS_RESOLVING == call_state); - if (verbose) - FPRINTF (stdout, - "%s", - _("Resolved address. Now ringing other party.\n")); + FPRINTF (stdout, + _("Resolved address of `%s'. Now ringing other party.\n"), + peer_name); call_state = CS_RINGING; break; case GNUNET_CONVERSATION_EC_CALL_PICKED_UP: @@ -524,6 +524,7 @@ do_call (const char *arg) GNUNET_free_non_null (peer_name); peer_name = GNUNET_strdup (arg); call_state = CS_RESOLVING; + GNUNET_assert (NULL == call); call = GNUNET_CONVERSATION_call_start (cfg, caller_id, arg, @@ -1011,8 +1012,6 @@ do_stop_task (void *cls, mic = NULL; GNUNET_free (ego_name); ego_name = NULL; - GNUNET_CONFIGURATION_destroy (cfg); - cfg = NULL; GNUNET_free_non_null (peer_name); phone_state = PS_ERROR; } @@ -1175,6 +1174,11 @@ main (int argc, char *const *argv) gettext_noop ("Enables having a conversation with other GNUnet users."), options, &run, NULL); GNUNET_free ((void *) argv); + if (NULL != cfg) + { + GNUNET_CONFIGURATION_destroy (cfg); + cfg = NULL; + } return (GNUNET_OK == ret) ? 0 : 1; } diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index b12d0e193..7fbff1fac 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c @@ -978,7 +978,7 @@ handle_mesh_hangup_message (void *cls, } line = ch->line; *channel_ctx = NULL; - hup.header.size = sizeof (hup); + hup.header.size = htons (sizeof (hup)); hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP); hup.cid = ch->cid; status = ch->status; @@ -1057,7 +1057,7 @@ handle_mesh_pickup_message (void *cls, mq_done_finish_caller_shutdown (ch); return GNUNET_SYSERR; } - pick.header.size = sizeof (pick); + pick.header.size = htons (sizeof (pick)); pick.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP); pick.cid = ch->cid; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1107,7 +1107,7 @@ handle_mesh_suspend_message (void *cls, return GNUNET_SYSERR; } line = ch->line; - suspend.header.size = sizeof (suspend); + suspend.header.size = htons (sizeof (suspend)); suspend.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND); suspend.cid = ch->cid; GNUNET_MESH_receive_done (channel); @@ -1165,7 +1165,7 @@ handle_mesh_resume_message (void *cls, return GNUNET_SYSERR; } line = ch->line; - resume.header.size = sizeof (resume); + resume.header.size = htons (sizeof (resume)); resume.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME); resume.cid = ch->cid; GNUNET_MESH_receive_done (channel); @@ -1341,7 +1341,7 @@ inbound_end (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh channel destroyed by mesh in state %d\n", ch->status); - hup.header.size = sizeof (hup); + hup.header.size = htons (sizeof (hup)); hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP); hup.cid = ch->cid; switch (ch->status)