handling replies continuously from server
[oweals/gnunet.git] / src / util / peer.c
index 62fa0e2f2820634e1e039b4b465eaddde0416ff7..2444cb9f8b8fbf31ee6d40cc975ee8e3e1a579e6 100644 (file)
@@ -27,6 +27,8 @@
 #include "platform.h"
 #include "gnunet_peer_lib.h"
 
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
 
 struct PeerEntry
 {
@@ -90,17 +92,13 @@ GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid)
     return 0;
   off = (long) GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey);
   e = (off == 0) ? NULL : &table[off];
-  if (e != NULL)
-  {
-    GNUNET_assert (e->rc > 0);
-    return e->pid;
-  }
-  else
-  {
+  if (e == NULL)
     return 0;
-  }
+  GNUNET_assert (e->rc > 0);
+  return e->pid;
 }
 
+
 /**
  * Intern an peer identity.  If the identity is already known, its
  * reference counter will be increased by one.
@@ -157,7 +155,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
 
 /**
  * Decrement multiple RCs of peer identities by one.
- * 
+ *
  * @param ids array of PIDs to decrement the RCs of
  * @param count size of the ids array
  */
@@ -181,8 +179,8 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id *ids, unsigned int count)
     {
       GNUNET_break (GNUNET_OK ==
                     GNUNET_CONTAINER_multihashmap_remove (map,
-                                                          &table[id].id.
-                                                          hashPubKey,
+                                                          &table[id].
+                                                          id.hashPubKey,
                                                           (void *) (long) id));
       table[id].pid = free_list_start;
       free_list_start = id;
@@ -210,8 +208,8 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
   {
     GNUNET_break (GNUNET_OK ==
                   GNUNET_CONTAINER_multihashmap_remove (map,
-                                                        &table[id].id.
-                                                        hashPubKey,
+                                                        &table[id].
+                                                        id.hashPubKey,
                                                         (void *) (long) id));
     table[id].pid = free_list_start;
     free_list_start = id;