minor fixes
authorChristian Grothoff <christian@grothoff.org>
Tue, 11 May 2010 20:34:28 +0000 (20:34 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 11 May 2010 20:34:28 +0000 (20:34 +0000)
src/arm/gnunet-service-manager.c
src/fs/gnunet-service-fs.c
src/topology/gnunet-daemon-topology.c
src/util/peer.c

index 457600c577bb9b2882c2a2c9ab4f57d6966f0d10..931d0479083ad95f9259739d8ed2911354ae7463 100644 (file)
@@ -591,7 +591,8 @@ void stop_listening (const char *serviceName)
           (strcmp (pos->serviceName, serviceName) != 0) )
        continue;
       GNUNET_SCHEDULER_cancel (scheduler, pos->acceptTask);
-      GNUNET_NETWORK_socket_close (pos->listeningSocket);
+      GNUNET_break (GNUNET_OK ==
+                   GNUNET_NETWORK_socket_close (pos->listeningSocket));
       GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
                                   serviceListeningInfoList_tail, 
                                   pos);
@@ -641,7 +642,8 @@ acceptConnection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                       serviceListeningInfo);
       return;
     }
-  GNUNET_NETWORK_socket_close (serviceListeningInfo->listeningSocket);
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_NETWORK_socket_close (serviceListeningInfo->listeningSocket));
   GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
                               serviceListeningInfoList_tail, 
                               serviceListeningInfo);
@@ -712,6 +714,7 @@ createListeningSocket (struct sockaddr *sa,
                  serviceName,
                  GNUNET_a2s (sa, addr_len),
                  STRERROR (errno));
+      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
       GNUNET_free (sa);
       return;
     }
@@ -719,7 +722,7 @@ createListeningSocket (struct sockaddr *sa,
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
                           "listen");
-      GNUNET_NETWORK_socket_close (sock);
+      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
       GNUNET_free (sa);
       return;
     }
@@ -794,14 +797,18 @@ prepareServices (const struct GNUNET_CONFIGURATION_Handle
   scheduler = sched;
   cfg = configurationHandle;
   /* Split the default services into a list */
-  GNUNET_CONFIGURATION_get_value_string (cfg, "arm", "DEFAULTSERVICES",
-                                        &defaultServicesString);
-  addDefaultServicesToList (defaultServicesString);
-  GNUNET_free (defaultServicesString);
+  if (GNUNET_OK ==
+      GNUNET_CONFIGURATION_get_value_string (cfg, "arm", "DEFAULTSERVICES",
+                                            &defaultServicesString))
+    {
+      addDefaultServicesToList (defaultServicesString);
+      GNUNET_free (defaultServicesString);    
 #if DEBUG_SERVICE_MANAGER
-  printDefaultServicesList ();
+      printDefaultServicesList ();
 #endif
-  /* Spot the services from the configuration and create a listening socket for each */
+    }
+  /* Spot the services from the configuration and create a listening
+     socket for each */
   GNUNET_CONFIGURATION_iterate (cfg, &checkPortNumberCB, NULL);
 }
 
index 84a4f1d658bd2ee6f0f4531d5aa7628fcda9b622..42dd2d23beac7f1988f1b0cf263bd77797596349 100644 (file)
@@ -769,10 +769,11 @@ peer_connect_handler (void *cls,
 
   cp = GNUNET_malloc (sizeof (struct ConnectedPeer));
   cp->pid = GNUNET_PEER_intern (peer);
-  GNUNET_CONTAINER_multihashmap_put (connected_peers,
-                                    &peer->hashPubKey,
-                                    cp,
-                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_CONTAINER_multihashmap_put (connected_peers,
+                                                  &peer->hashPubKey,
+                                                  cp,
+                                                  GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
 }
 
 
@@ -792,9 +793,10 @@ destroy_request (void *cls,
   const struct GNUNET_PeerIdentity * peer = cls;
   struct PendingRequest *pr = value;
   
-  GNUNET_CONTAINER_multihashmap_remove (peer_request_map,
-                                       &peer->hashPubKey,
-                                       pr);
+  GNUNET_break (GNUNET_YES ==
+               GNUNET_CONTAINER_multihashmap_remove (peer_request_map,
+                                                     &peer->hashPubKey,
+                                                     pr));
   destroy_pending_request (pr);
   return GNUNET_YES;
 }
@@ -831,9 +833,10 @@ peer_disconnect_handler (void *cls,
          cp->last_client_replies[i] = NULL;
        }
     }
-  GNUNET_CONTAINER_multihashmap_remove (connected_peers,
-                                       &peer->hashPubKey,
-                                       cp);
+  GNUNET_break (GNUNET_YES ==
+               GNUNET_CONTAINER_multihashmap_remove (connected_peers,
+                                                     &peer->hashPubKey,
+                                                     cp));
   GNUNET_PEER_change_rc (cp->pid, -1);
   GNUNET_PEER_decrement_rcs (cp->last_p2p_replies, P2P_SUCCESS_LIST_SIZE);
   if (NULL != cp->cth)
@@ -2588,14 +2591,16 @@ handle_p2p_get (void *cls,
     }
 
   pr->cp = cp;
-  GNUNET_CONTAINER_multihashmap_put (query_request_map,
-                                    &gm->query,
-                                    pr,
-                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  GNUNET_CONTAINER_multihashmap_put (peer_request_map,
-                                    &other->hashPubKey,
-                                    pr,
-                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_CONTAINER_multihashmap_put (query_request_map,
+                                                  &gm->query,
+                                                  pr,
+                                                  GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_CONTAINER_multihashmap_put (peer_request_map,
+                                                  &other->hashPubKey,
+                                                  pr,
+                                                  GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
   
   pr->hnode = GNUNET_CONTAINER_heap_insert (requests_by_expiration_heap,
                                            pr,
@@ -2810,10 +2815,11 @@ handle_start_search (void *cls,
     default:
       break;
     }
-  GNUNET_CONTAINER_multihashmap_put (query_request_map,
-                                    &sm->query,
-                                    pr,
-                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_CONTAINER_multihashmap_put (query_request_map,
+                                                  &sm->query,
+                                                  pr,
+                                                  GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
   if (type == GNUNET_BLOCK_TYPE_DBLOCK)
     type = GNUNET_BLOCK_TYPE_ANY; /* get on-demand blocks too! */
   pr->drq = GNUNET_FS_drq_get (&sm->query,
index e827fad2cc3162eb700c192329e77ab072cd388b..cfe1a66e849d6c534cde2e20510fc6ae29995e54 100644 (file)
@@ -492,10 +492,11 @@ make_peer (const struct
       memcpy (ret->hello, hello,
              GNUNET_HELLO_size (hello));
     }
-  GNUNET_CONTAINER_multihashmap_put (peers,
-                                    &peer->hashPubKey,
-                                    ret,
-                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_CONTAINER_multihashmap_put (peers,
+                                                  &peer->hashPubKey,
+                                                  ret,
+                                                  GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   return ret;
 }
 
index 5c00d5580e7cc1ccb53f85cb55607671958904c3..f30c720aa073ad8e97165d8af1a079165bec3103 100644 (file)
@@ -116,10 +116,11 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
   table[ret].id = *pid;
   table[ret].rc = 1;
   table[ret].pid = ret;
-  GNUNET_CONTAINER_multihashmap_put (map,
-                                     &pid->hashPubKey,
-                                     &table[ret],
-                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+  GNUNET_break (GNUNET_OK ==
+               GNUNET_CONTAINER_multihashmap_put (map,
+                                                  &pid->hashPubKey,
+                                                  &table[ret],
+                                                  GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   return ret;
 }
 
@@ -148,9 +149,10 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, unsigned int count)
       table[id].rc--;
       if (table[id].rc == 0)
         {
-          GNUNET_CONTAINER_multihashmap_remove (map,
-                                                &table[id].id.hashPubKey,
-                                                &table[id]);
+          GNUNET_break (GNUNET_OK ==
+                       GNUNET_CONTAINER_multihashmap_remove (map,
+                                                             &table[id].id.hashPubKey,
+                                                             &table[id]));
           table[id].pid = free_list_start;
           free_list_start = id;
         }
@@ -175,9 +177,10 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
   table[id].rc += delta;
   if (table[id].rc == 0)
     {
-      GNUNET_CONTAINER_multihashmap_remove (map,
-                                            &table[id].id.hashPubKey,
-                                            &table[id]);
+      GNUNET_break (GNUNET_OK ==
+                   GNUNET_CONTAINER_multihashmap_remove (map,
+                                                         &table[id].id.hashPubKey,
+                                                         &table[id]));
       table[id].pid = free_list_start;
       free_list_start = id;
     }