aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-10-06 09:27:09 +0000
committerNathan S. Evans <evans@in.tum.de>2010-10-06 09:27:09 +0000
commit8dda1a3517c7c27d1ce48b27f234c15a0e394666 (patch)
tree614308b335c14eeb6736a79fcb2118e86c8b981b /src
parentcf6c6eea38863e2abe0421762c5e9dd3becc0b24 (diff)
downloadgnunet-8dda1a3517c7c27d1ce48b27f234c15a0e394666.tar.gz
gnunet-8dda1a3517c7c27d1ce48b27f234c15a0e394666.zip
type errors, test case errors, etc.
Diffstat (limited to 'src')
-rw-r--r--src/dht/dht.h2
-rw-r--r--src/dht/dht_api_get_put.c8
-rw-r--r--src/dht/gnunet-service-dht.c22
-rw-r--r--src/dht/test_dht_api_peer1.conf5
4 files changed, 28 insertions, 9 deletions
diff --git a/src/dht/dht.h b/src/dht/dht.h
index 0f9d28fe4..b5006ab8c 100644
--- a/src/dht/dht.h
+++ b/src/dht/dht.h
@@ -27,7 +27,7 @@
27#ifndef DHT_H_ 27#ifndef DHT_H_
28#define DHT_H_ 28#define DHT_H_
29 29
30#define DEBUG_DHT GNUNET_NO 30#define DEBUG_DHT GNUNET_YES
31 31
32/** 32/**
33 * Needs to be GNUNET_YES for logging to dhtlog to work! 33 * Needs to be GNUNET_YES for logging to dhtlog to work!
diff --git a/src/dht/dht_api_get_put.c b/src/dht/dht_api_get_put.c
index d0e40ca70..c6cd2c57a 100644
--- a/src/dht/dht_api_get_put.c
+++ b/src/dht/dht_api_get_put.c
@@ -72,13 +72,13 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
72 put_msg = (struct GNUNET_DHT_PutMessage*) buf; 72 put_msg = (struct GNUNET_DHT_PutMessage*) buf;
73 put_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_PUT); 73 put_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_PUT);
74 put_msg->header.size = htons (sizeof (struct GNUNET_DHT_PutMessage) + size); 74 put_msg->header.size = htons (sizeof (struct GNUNET_DHT_PutMessage) + size);
75 put_msg->type = htons (type); 75 put_msg->type = htonl ((uint32_t)type);
76 put_msg->expiration = GNUNET_TIME_absolute_hton (exp); 76 put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
77 memcpy (&put_msg[1], data, size); 77 memcpy (&put_msg[1], data, size);
78 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 78 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
79 "Starting route for %u byte `%s' message\n", 79 "Starting route for %u byte `%s' message of type %u \n",
80 (unsigned int) (sizeof (struct GNUNET_DHT_PutMessage) + size), 80 (unsigned int) (sizeof (struct GNUNET_DHT_PutMessage) + size),
81 "PUT"); 81 "PUT", type);
82 GNUNET_break (NULL == 82 GNUNET_break (NULL ==
83 GNUNET_DHT_route_start (handle, 83 GNUNET_DHT_route_start (handle,
84 key, 84 key,
@@ -212,7 +212,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
212 get_msg->header.size = htons (sizeof (struct GNUNET_DHT_GetMessage) + 212 get_msg->header.size = htons (sizeof (struct GNUNET_DHT_GetMessage) +
213 xquery_size + 213 xquery_size +
214 bf_size); 214 bf_size);
215 get_msg->type = htons ((uint32_t) type); 215 get_msg->type = htonl ((uint32_t) type);
216 get_msg->bf_mutator = bf_mutator; 216 get_msg->bf_mutator = bf_mutator;
217 get_msg->xquery_size = htons ((uint16_t) xquery_size); 217 get_msg->xquery_size = htons ((uint16_t) xquery_size);
218 get_msg->bf_size = htons (bf_size); 218 get_msg->bf_size = htons (bf_size);
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index e997e48e5..fb93cef6e 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -2187,10 +2187,22 @@ datacache_get_iterator (void *cls,
2187 GNUNET_free (get_result); 2187 GNUNET_free (get_result);
2188 break; 2188 break;
2189 case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: 2189 case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
2190#if DEBUG_DHT
2191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2192 "`%s:%s': Duplicate block error\n", my_short_id, "DHT");
2193#endif
2190 break; 2194 break;
2191 case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: 2195 case GNUNET_BLOCK_EVALUATION_RESULT_INVALID:
2196#if DEBUG_DHT
2197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2198 "`%s:%s': Invalid request error\n", my_short_id, "DHT");
2199#endif
2192 break; 2200 break;
2193 case GNUNET_BLOCK_EVALUATION_REQUEST_VALID: 2201 case GNUNET_BLOCK_EVALUATION_REQUEST_VALID:
2202#if DEBUG_DHT
2203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2204 "`%s:%s': Valid request, no results.\n", my_short_id, "DHT");
2205#endif
2194 GNUNET_break (0); 2206 GNUNET_break (0);
2195 break; 2207 break;
2196 case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID: 2208 case GNUNET_BLOCK_EVALUATION_REQUEST_INVALID:
@@ -2198,6 +2210,10 @@ datacache_get_iterator (void *cls,
2198 msg_ctx->do_forward = GNUNET_NO; 2210 msg_ctx->do_forward = GNUNET_NO;
2199 break; 2211 break;
2200 case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED: 2212 case GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED:
2213#if DEBUG_DHT
2214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2215 "`%s:%s': Unsupported block type (%u) in response!\n", my_short_id, "DHT", type);
2216#endif
2201 /* msg_ctx->do_forward = GNUNET_NO; // not sure... */ 2217 /* msg_ctx->do_forward = GNUNET_NO; // not sure... */
2202 break; 2218 break;
2203 } 2219 }
@@ -2280,7 +2296,7 @@ handle_dht_get (void *cls,
2280 "`%s:%s': Received `%s' request, message type %u, key %s, uid %llu\n", 2296 "`%s:%s': Received `%s' request, message type %u, key %s, uid %llu\n",
2281 my_short_id, 2297 my_short_id,
2282 "DHT", "GET", 2298 "DHT", "GET",
2283 get_type, 2299 type,
2284 GNUNET_h2s (&message_context->key), 2300 GNUNET_h2s (&message_context->key),
2285 message_context->unique_id); 2301 message_context->unique_id);
2286#endif 2302#endif
@@ -3841,7 +3857,7 @@ malicious_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3841 dhtlog_handle->insert_dhtkey(NULL, &key); 3857 dhtlog_handle->insert_dhtkey(NULL, &key);
3842#endif 3858#endif
3843 increment_stats(STAT_PUT_START); 3859 increment_stats(STAT_PUT_START);
3844 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious PUT message with hash %s", my_short_id, "DHT", GNUNET_h2s(&key)); 3860 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious PUT message with hash %s\n", my_short_id, "DHT", GNUNET_h2s(&key));
3845 route_message(NULL, &put_message.header, &message_context); 3861 route_message(NULL, &put_message.header, &message_context);
3846 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, malicious_put_frequency), &malicious_put_task, NULL); 3862 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, malicious_put_frequency), &malicious_put_task, NULL);
3847 3863
@@ -3884,7 +3900,7 @@ malicious_get_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3884 dhtlog_handle->insert_dhtkey(NULL, &key); 3900 dhtlog_handle->insert_dhtkey(NULL, &key);
3885#endif 3901#endif
3886 increment_stats(STAT_GET_START); 3902 increment_stats(STAT_GET_START);
3887 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious GET message with hash %s", my_short_id, "DHT", GNUNET_h2s(&key)); 3903 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s Sending malicious GET message with hash %s\n", my_short_id, "DHT", GNUNET_h2s(&key));
3888 route_message (NULL, &get_message.header, &message_context); 3904 route_message (NULL, &get_message.header, &message_context);
3889 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, malicious_get_frequency), &malicious_get_task, NULL); 3905 GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, malicious_get_frequency), &malicious_get_task, NULL);
3890} 3906}
diff --git a/src/dht/test_dht_api_peer1.conf b/src/dht/test_dht_api_peer1.conf
index 375d7cde9..b6fbe20cf 100644
--- a/src/dht/test_dht_api_peer1.conf
+++ b/src/dht/test_dht_api_peer1.conf
@@ -9,6 +9,9 @@ ACCEPT_FROM = 127.0.0.1;
9HOSTNAME = localhost 9HOSTNAME = localhost
10PORT = 2100 10PORT = 2100
11 11
12[block]
13plugins = dht test
14
12[dhtcache] 15[dhtcache]
13QUOTA = 1000000 16QUOTA = 1000000
14DATABASE = sqlite 17DATABASE = sqlite
@@ -27,7 +30,7 @@ TOTAL_QUOTA_IN = 3932160
27PORT = 12092 30PORT = 12092
28 31
29[arm] 32[arm]
30DEFAULTSERVICES = 33DEFAULTSERVICES = core dht
31PORT = 12366 34PORT = 12366
32DEBUG = NO 35DEBUG = NO
33 36