Discard large metadata items first
[oweals/gnunet.git] / src / integration-tests / connection_watchdog.c
index a06b5a763a319a6ee5315c2a7b2a739f734f35fc..0998a367e697dc2d8f197417be41c0877162669c 100644 (file)
@@ -121,7 +121,7 @@ struct TransportPlugin *ptail;
 
 static int 
 map_check_it (void *cls,
-             const GNUNET_HashCode * key,
+             const struct GNUNET_HashCode * key,
              void *value)
 {
   int *fail = cls;
@@ -142,7 +142,7 @@ map_check_it (void *cls,
 
 static int 
 map_cleanup_it (void *cls,
-               const GNUNET_HashCode * key,
+               const struct GNUNET_HashCode * key,
                void *value)
 {
   struct PeerContainer *pc = value;
@@ -451,7 +451,7 @@ return mlen;
 
 
 int map_ping_it (void *cls,
-                  const GNUNET_HashCode * key,
+                  const struct GNUNET_HashCode * key,
                   void *value)
 {
   struct PeerContainer *pc = value;
@@ -572,6 +572,8 @@ map_connect (const struct GNUNET_PeerIdentity *peer, void * source)
   }
 
   pc = GNUNET_CONTAINER_multihashmap_get(peers, &peer->hashPubKey);
+  GNUNET_assert (NULL != pc);
+
   if (source == th)
   {
     if (GNUNET_NO == pc->transport_connected)
@@ -658,6 +660,8 @@ map_disconnect (const struct GNUNET_PeerIdentity * peer, void * source)
   }
 
   pc = GNUNET_CONTAINER_multihashmap_get(peers, &peer->hashPubKey);
+  GNUNET_assert (NULL != pc);
+
   if (source == th)
   {
     if (NULL != pc->th_ping)
@@ -1052,7 +1056,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   init();
 
   stats = GNUNET_STATISTICS_create ("watchdog", cfg);
-  peers = GNUNET_CONTAINER_multihashmap_create (20);
+  peers = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
 
   th = GNUNET_TRANSPORT_connect(cfg, NULL, NULL,
                                 &transport_notify_receive_cb,
@@ -1090,10 +1094,15 @@ main (int argc, char *const *argv)
     GNUNET_NO, &GNUNET_GETOPT_set_one, &ping},
     GNUNET_GETOPT_OPTION_END
   };
-  return (GNUNET_OK ==
-          GNUNET_PROGRAM_run (argc, argv, "cn",
-                              gettext_noop ("help text"), options, &run,
-                              NULL)) ? ret : 1;
+
+  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+    return 2;
+  ret = (GNUNET_OK ==
+        GNUNET_PROGRAM_run (argc, argv, "cn",
+                            gettext_noop ("help text"), options, &run,
+                            NULL)) ? ret : 1;
+  GNUNET_free ((void*) argv);
+  return ret;
 }
 
 /* end of connection_watchdog.c */