fixing unchecked return values
[oweals/gnunet.git] / src / transport / gnunet-service-transport_neighbours.c
index 6a413874a38168199c1ca616295bffc1f0c82439..e4c3ecd78bb6406b68f318665464bf0835a3704b 100644 (file)
@@ -413,7 +413,7 @@ struct NeighbourMapEntry
    * Flag to set if we still need to send a CONNECT_ACK message to the other peer
    * (once we have an address to use and the peer has been allowed by our
    * blacklist).  Initially set to #ACK_UNDEFINED. Set to #ACK_SEND_CONNECT_ACK
-   * if we need to send a CONNECT_ACK.  Set to #SESSION_ACK if we did
+   * if we need to send a CONNECT_ACK.  Set to #ACK_SEND_SESSION_ACK if we did
    * send a CONNECT_ACK and should go to 'S_CONNECTED' upon receiving a
    * 'SESSION_ACK' (regardless of what our own state machine might say).
    */
@@ -447,7 +447,7 @@ struct NeighbourMapEntry
 
 
 /**
- * Context for blacklist checks and the #handle_test_blacklist_cont()
+ * Context for blacklist checks and the #try_connect_bl_check_cont()
  * function.  Stores information about ongoing blacklist checks.
  */
 struct BlackListCheckContext
@@ -2081,8 +2081,8 @@ free_notification_cb(void *cls, const struct GNUNET_PeerIdentity *key,
   /* struct NeighbourMapEntry *n = cls; */
   struct QuotaNotificationRequest *qnr = value;
 
-  GNUNET_CONTAINER_multipeermap_remove (registered_quota_notifications, key,
-      qnr);
+  GNUNET_break (GNUNET_OK != GNUNET_CONTAINER_multipeermap_remove (registered_quota_notifications, key,
+      qnr));
   GNUNET_free(qnr->plugin);
   GNUNET_free(qnr);
 
@@ -2425,8 +2425,10 @@ switch_address_bl_check_cont (void *cls,
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
   struct NeighbourMapEntry *n;
 
+  papi = GST_plugins_find (blc_ctx->address->transport_name);
+
   if ( (NULL == (n = lookup_neighbour (peer))) || (result == GNUNET_NO) ||
-       (NULL == (papi = GST_plugins_find (blc_ctx->address->transport_name))) )
+       (NULL == (papi)) )
   {
     if (NULL == n)
     {
@@ -2442,7 +2444,7 @@ switch_address_bl_check_cont (void *cls,
           blc_ctx->session,
           GNUNET_i2s (&blc_ctx->address->peer));
     }
-    if (NULL == (papi = GST_plugins_find (blc_ctx->address->transport_name)))
+    if (NULL == papi)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
           "Plugin `%s' for suggested address `%s' session %p for peer `%s' is not available\n",
@@ -2676,7 +2678,6 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
 {
   struct NeighbourMapEntry *n;
   struct GST_BlacklistCheck *blc;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
   struct BlacklistCheckSwitchContext *blc_ctx;
   int c;
 
@@ -2693,7 +2694,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
   }
 
   /* Check if plugin is available */
-  if (NULL == (papi = GST_plugins_find (address->transport_name)))
+  if (NULL == (GST_plugins_find (address->transport_name)))
   {
     /* we don't have the plugin for this address */
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3431,15 +3432,16 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
     /* Notify about connection */
     connect_notify_cb (callback_cls, &n->id,
                      n->primary_address.bandwidth_in,
-                     n->primary_address.bandwidth_out);
+                     n->primary_address.bandwidth_out);\
+
+     GNUNET_STATISTICS_set (GST_stats,
+                            gettext_noop ("# peers connected"),
+                            ++neighbours_connected,
+                            GNUNET_NO);
   }
 
   set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED,
       GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
-  GNUNET_STATISTICS_set (GST_stats,
-                        gettext_noop ("# peers connected"),
-                        ++neighbours_connected,
-                        GNUNET_NO);
 
   /* Add session to ATS since no session was given (NULL) and we may have
    * obtained a new session */