api change for malicious peer bug when running distributed tests, stop arm from repea...
authorNathan S. Evans <evans@in.tum.de>
Tue, 8 Mar 2011 15:24:09 +0000 (15:24 +0000)
committerNathan S. Evans <evans@in.tum.de>
Tue, 8 Mar 2011 15:24:09 +0000 (15:24 +0000)
src/arm/gnunet-service-arm_interceptor.c
src/dht/dht_api.c
src/dht/gnunet-dht-driver.c
src/dht/gnunet-service-dht.c
src/include/gnunet_dht_service.h

index 57650df04e475b0c510e08be36ab1e84da4afd24..c86530b6f603fc72dbf106de27a6b8295deda3a5 100644 (file)
@@ -1094,6 +1094,8 @@ createListeningSocket (struct sockaddr *sa,
       sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
       break;
     case AF_UNIX:
+      if (strcmp(GNUNET_a2s (sa, addr_len), "@") == 0) /* Do not bind to blank UNIX path! */
+        return;
       sock = GNUNET_NETWORK_socket_create (PF_UNIX, SOCK_STREAM, 0);
       break;
     default:
index 820bf35c87aed88d282aaab4f47d3619060112e3..5d3a83d4b81d43004e51c842f47170e747db77dd 100644 (file)
@@ -238,8 +238,10 @@ try_connect (struct GNUNET_DHT_Handle *handle)
                  _("Failed to connect to the DHT service!\n"));
       return GNUNET_NO;
     }
+#if DEBUG_DHT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Starting to process replies from DHT\n");
+#endif
   GNUNET_CLIENT_receive (handle->client,
                          &service_message_handler,
                          handle, 
@@ -871,10 +873,13 @@ GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle,
  *
  * @param handle handle to the DHT service
  * @param frequency delay between sending malicious messages
+ * @param cont continuation to call when done (transmitting request to service)
+ * @param cont_cls closure for cont
  */
 void
 GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle,
-                                struct GNUNET_TIME_Relative frequency)
+                                struct GNUNET_TIME_Relative frequency, GNUNET_SCHEDULER_Task cont,
+                           void *cont_cls)
 {
   if (frequency.rel_value > UINT16_MAX)
     {
@@ -883,7 +888,7 @@ GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle,
     }
   send_control_message (handle,
                        GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET, frequency.rel_value,
-                       NULL, NULL);
+                       cont, cont_cls);
 }
 
 /**
@@ -892,10 +897,13 @@ GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle,
  *
  * @param handle handle to the DHT service
  * @param frequency delay between sending malicious messages
+ * @param cont continuation to call when done (transmitting request to service)
+ * @param cont_cls closure for cont
  */
 void 
 GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle, 
-                                struct GNUNET_TIME_Relative frequency)
+                                struct GNUNET_TIME_Relative frequency, GNUNET_SCHEDULER_Task cont,
+                           void *cont_cls)
 {
   if (frequency.rel_value > UINT16_MAX)
     {
@@ -905,7 +913,7 @@ GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle,
 
   send_control_message (handle,
                        GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT, frequency.rel_value,
-                       NULL, NULL);
+                       cont, cont_cls);
 }
 
 
@@ -914,13 +922,17 @@ GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle,
  * all requests received.
  *
  * @param handle handle to the DHT service
+ * @param cont continuation to call when done (transmitting request to service)
+ * @param cont_cls closure for cont
+ *
  */
 void 
-GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle)
+GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, GNUNET_SCHEDULER_Task cont,
+    void *cont_cls)
 {
   send_control_message (handle,
-                       GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP, 0,
-                       NULL, NULL);
+                        GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP, 0,
+                        cont, cont_cls);
 }
 
 #endif
index c73bf115b284848e9cf56636fa822cbdd63defdc..7a1606219a744d3c8b88c6bcc22be609f3438cc1 100644 (file)
@@ -2690,7 +2690,7 @@ continue_puts_and_gets(void *cls,
  */
 static void
 malicious_disconnect_task(void *cls,
-    const struct GNUNET_SCHEDULER_TaskContext * tc)
+                          const struct GNUNET_SCHEDULER_TaskContext * tc)
 {
   struct MaliciousContext *ctx = cls;
   outstanding_malicious--;
@@ -2705,7 +2705,6 @@ malicious_disconnect_task(void *cls,
     {
       fprintf (stderr, "Finished setting all malicious peers up!\n");
     }
-
 }
 
 /**
@@ -2753,16 +2752,13 @@ set_malicious(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
   switch (ctx->malicious_type)
     {
   case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET:
-    GNUNET_DHT_set_malicious_getter (ctx->dht_handle, malicious_get_frequency);
-    GNUNET_SCHEDULER_add_now (&malicious_done_task, ctx);
+    GNUNET_DHT_set_malicious_getter (ctx->dht_handle, malicious_get_frequency, &malicious_done_task, ctx);
     break;
   case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT:
-    GNUNET_DHT_set_malicious_putter (ctx->dht_handle, malicious_put_frequency);
-    GNUNET_SCHEDULER_add_now (&malicious_done_task, ctx);
+    GNUNET_DHT_set_malicious_putter (ctx->dht_handle, malicious_put_frequency, &malicious_done_task, ctx);
     break;
   case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP:
-    GNUNET_DHT_set_malicious_dropper (ctx->dht_handle);
-    GNUNET_SCHEDULER_add_now (&malicious_done_task, ctx);
+    GNUNET_DHT_set_malicious_dropper (ctx->dht_handle, &malicious_done_task, ctx);
     break;
   default:
     break;
index f205abbae7a55f1714e8fe41c29db8a86cc938fc..c5eded564cb88d92defa23d210b6d78832a8aae4 100644 (file)
@@ -4691,6 +4691,7 @@ handle_dht_control_message (void *cls, struct GNUNET_SERVER_Client *client,
 {
   const struct GNUNET_DHT_ControlMessage *dht_control_msg =
     (const struct GNUNET_DHT_ControlMessage *) message;
+
 #if DEBUG_DHT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "`%s:%s': Received `%s' request from client, command %d\n",
index d4b4d9a4c74d5036554968affda7c79fd744a798..e57dd718c607bcb769ac8d7ecf3fb14d787c1928 100644 (file)
@@ -384,9 +384,13 @@ GNUNET_DHT_find_peers (struct GNUNET_DHT_Handle *handle,
  * all requests received.
  *
  * @param handle handle to the DHT service
+ * @param cont continuation to call when done (transmitting request to service)
+ * @param cont_cls closure for cont
+ *
  */
 void 
-GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle);
+GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle, GNUNET_SCHEDULER_Task cont,
+    void *cont_cls);
 
 
 /**
@@ -394,11 +398,14 @@ GNUNET_DHT_set_malicious_dropper (struct GNUNET_DHT_Handle *handle);
  * requests every 'frequency' milliseconds.
  *
  * @param handle handle to the DHT service
- * @param frequency delay (in milliseconds) between sending malicious messages
+ * @param frequency delay between sending malicious messages
+ * @param cont continuation to call when done (transmitting request to service)
+ * @param cont_cls closure for cont
  */
 void 
 GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle,
-                                struct GNUNET_TIME_Relative frequency);
+         struct GNUNET_TIME_Relative frequency, GNUNET_SCHEDULER_Task cont,
+          void *cont_cls);
 
 
 /**
@@ -407,10 +414,13 @@ GNUNET_DHT_set_malicious_putter (struct GNUNET_DHT_Handle *handle,
  *
  * @param handle handle to the DHT service
  * @param frequency delay between sending malicious messages
+ * @param cont continuation to call when done (transmitting request to service)
+ * @param cont_cls closure for cont
  */
-void 
-GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle, 
-                                struct GNUNET_TIME_Relative frequency);
+void
+GNUNET_DHT_set_malicious_getter (struct GNUNET_DHT_Handle *handle,
+         struct GNUNET_TIME_Relative frequency, GNUNET_SCHEDULER_Task cont,
+          void *cont_cls);
 
 
 #endif