type errors, test case errors, etc.
authorNathan S. Evans <evans@in.tum.de>
Wed, 6 Oct 2010 09:27:09 +0000 (09:27 +0000)
committerNathan S. Evans <evans@in.tum.de>
Wed, 6 Oct 2010 09:27:09 +0000 (09:27 +0000)
src/dht/dht.h
src/dht/dht_api_get_put.c
src/dht/gnunet-service-dht.c
src/dht/test_dht_api_peer1.conf

index 0f9d28fe4c96b9875dc584685959f581aff63b57..b5006ab8c61e628b35d642af7936a6b913613824 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef DHT_H_
 #define DHT_H_
 
-#define DEBUG_DHT GNUNET_NO
+#define DEBUG_DHT GNUNET_YES
 
 /**
  * Needs to be GNUNET_YES for logging to dhtlog to work!
index d0e40ca705c370cd082f30b50998b58246137547..c6cd2c57a4751cb19acf2644f3599b75387ab59c 100644 (file)
@@ -72,13 +72,13 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
   put_msg = (struct GNUNET_DHT_PutMessage*) buf;
   put_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_PUT);
   put_msg->header.size = htons (sizeof (struct GNUNET_DHT_PutMessage) + size);
-  put_msg->type = htons (type);
+  put_msg->type = htonl ((uint32_t)type);
   put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
   memcpy (&put_msg[1], data, size);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Starting route for %u byte `%s' message\n",
+             "Starting route for %u byte `%s' message of type %u \n",
              (unsigned int) (sizeof (struct GNUNET_DHT_PutMessage) + size),
-             "PUT");
+             "PUT", type);
   GNUNET_break (NULL ==
                GNUNET_DHT_route_start (handle, 
                                        key, 
@@ -212,7 +212,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
   get_msg->header.size = htons (sizeof (struct GNUNET_DHT_GetMessage) + 
                                xquery_size + 
                                bf_size);
-  get_msg->type = htons ((uint32_t) type);
+  get_msg->type = htonl ((uint32_t) type);
   get_msg->bf_mutator = bf_mutator;
   get_msg->xquery_size = htons ((uint16_t) xquery_size);
   get_msg->bf_size = htons (bf_size);
index e997e48e5d956bc4bb51c6de18937a9114883104..fb93cef6e52891effb7eb10a95de40b1f8beade1 100644 (file)
@@ -2187,10 +2187,22 @@ datacache_get_iterator (void *cls,
       GNUNET_free (get_result);
       break;
     case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
+#if DEBUG_DHT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "`%s:%s': Duplicate block error\n", my_short_id, "DHT");
+#endif
       break;
     case GNUNET_BLOCK_EVALUATION_RESULT_INVALID:
+#if DEBUG_DHT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "`%s:%s': Invalid request error\n", my_short_id, "DHT");
+#endif
       break;
     case GNUNET_BLOCK_EVALUATION_REQUEST_VALID:
+#if DEBUG_DHT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "`%s:%s': Valid request, no results.\n", my_short_id, "DHT");
+#endif
       GNUNET_break (0);
       break;
     case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID:
@@ -2198,6 +2210,10 @@ datacache_get_iterator (void *cls,
       msg_ctx->do_forward = GNUNET_NO;
       break;
     case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED:
+#if DEBUG_DHT
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "`%s:%s': Unsupported block type (%u) in response!\n", my_short_id, "DHT", type);
+#endif
       /* msg_ctx->do_forward = GNUNET_NO;  // not sure... */
       break;
     }  
@@ -2280,7 +2296,7 @@ handle_dht_get (void *cls,
               "`%s:%s': Received `%s' request, message type %u, key %s, uid %llu\n",
              my_short_id,
               "DHT", "GET", 
-             get_type,
+             type,
              GNUNET_h2s (&message_context->key),
               message_context->unique_id);
 #endif
@@ -3841,7 +3857,7 @@ malicious_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     dhtlog_handle->insert_dhtkey(NULL, &key);
 #endif
   increment_stats(STAT_PUT_START);
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious PUT message with hash %s", my_short_id, "DHT", GNUNET_h2s(&key));
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious PUT message with hash %s\n", my_short_id, "DHT", GNUNET_h2s(&key));
   route_message(NULL, &put_message.header, &message_context);
   GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, malicious_put_frequency), &malicious_put_task, NULL);
 
@@ -3884,7 +3900,7 @@ malicious_get_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     dhtlog_handle->insert_dhtkey(NULL, &key);
 #endif
   increment_stats(STAT_GET_START);
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious GET message with hash %s", my_short_id, "DHT", GNUNET_h2s(&key));
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious GET message with hash %s\n", my_short_id, "DHT", GNUNET_h2s(&key));
   route_message (NULL, &get_message.header, &message_context);
   GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, malicious_get_frequency), &malicious_get_task, NULL);
 }
index 375d7cde97b298c287e9ffb4e4b468026b591332..b6fbe20cfed278d474fa165a8a4f831501314798 100644 (file)
@@ -9,6 +9,9 @@ ACCEPT_FROM = 127.0.0.1;
 HOSTNAME = localhost
 PORT = 2100
 
+[block]
+plugins = dht test
+
 [dhtcache]
 QUOTA = 1000000
 DATABASE = sqlite
@@ -27,7 +30,7 @@ TOTAL_QUOTA_IN = 3932160
 PORT = 12092
 
 [arm]
-DEFAULTSERVICES = 
+DEFAULTSERVICES = core dht
 PORT = 12366
 DEBUG = NO