-fix missing endianess conversions
authorChristian Grothoff <christian@grothoff.org>
Sat, 16 Nov 2013 18:48:40 +0000 (18:48 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 16 Nov 2013 18:48:40 +0000 (18:48 +0000)
src/conversation/gnunet-conversation.c
src/conversation/gnunet-service-conversation.c

index 07cb8ac44e90641c8d1b7aceab51084a25fde208..2ea3d77cbbc1470090ce5d5bcc8ee643066b2ab8 100644 (file)
@@ -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;
 }
 
index b12d0e193f96ae2594a7242dd8ec240d0be519b7..7fbff1facef99b55f85085fad64bb617a601d496 100644 (file)
@@ -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)