- add 2s for new state, reduce buffer
[oweals/gnunet.git] / src / arm / arm_api.c
index 6c0dec4a6eafa2c244525301b078e243ebf7c518..1b83c31063e84d25519ee1ac4994ea21e0916893 100644 (file)
@@ -308,11 +308,12 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg)
 /**
  * Handler for ARM replies.
  *
- * @param cls our "struct GNUNET_ARM_Handle"
+ * @param cls our `struct GNUNET_ARM_Handle`
  * @param msg the message received from the arm service
  */
 static void
-client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
+client_notify_handler (void *cls,
+                       const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_ARM_Handle *h = cls;
   const struct GNUNET_ARM_Message *arm_msg;
@@ -353,7 +354,9 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
   cm = find_cm_by_id (h, id);
   if (NULL == cm)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id);
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Message with unknown id %llu\n",
+         id);
     return;
   }
   fail = GNUNET_NO;
@@ -460,7 +463,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
     if (NULL != cm->list_cont)
         cm->list_cont (cm->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, rcount,
                        list);
-    GNUNET_free (list);
+    GNUNET_free_non_null (list);
     break;
   }
   GNUNET_free (cm->msg);
@@ -471,10 +474,10 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
 /**
  * Transmit the next message to the arm service.
  *
- * @param cls closure with the 'struct GNUNET_ARM_Handle'
- * @param size number of bytes available in buf
+ * @param cls closure with the `struct GNUNET_ARM_Handle`
+ * @param size number of bytes available in @a buf
  * @param buf where the callee should write the message
- * @return number of bytes written to buf
+ * @return number of bytes written to @a buf
  */
 static size_t
 transmit_arm_message (void *cls, size_t size, void *buf)
@@ -488,8 +491,8 @@ transmit_arm_message (void *cls, size_t size, void *buf)
 
   notify_connection = GNUNET_NO;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-      "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n",
-      buf, size, h->currently_down ? "unconnected" : "connected");
+       "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n",
+       buf, size, h->currently_down ? "unconnected" : "connected");
   GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task);
   h->cth = NULL;
   if ((GNUNET_YES == h->currently_down) && (NULL != buf))
@@ -509,7 +512,8 @@ transmit_arm_message (void *cls, size_t size, void *buf)
   }
   if (NULL == (cm = h->control_pending_head))
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Queue is empty, not sending anything\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Queue is empty, not sending anything\n");
     msize = 0;
     goto end;
   }