aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-03-19 12:43:34 +0000
committerNathan S. Evans <evans@in.tum.de>2010-03-19 12:43:34 +0000
commit0c996c9a9e418c21c7e063d443f4fa1846b9448e (patch)
treeadcecf9285343713af6dfd1bb37aaa138b27a8bc /src/dht/gnunet-service-dht.c
parent9618f4481593c6300c04e8253f2e03a2380a899d (diff)
downloadgnunet-0c996c9a9e418c21c7e063d443f4fa1846b9448e.tar.gz
gnunet-0c996c9a9e418c21c7e063d443f4fa1846b9448e.zip
added better continuation behavior to get start, put, and route start. test case now properly handles message confirmation receipts from service. find_peer api call still needs implemented, but we are generally much closer to a working point. i'm sure there are coverity issues as well as doxygen crap to be addressed
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 2ff1384d7..426d78097 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -193,6 +193,10 @@ static void handle_dht_put (void *cls, struct GNUNET_DHT_PutMessage *put_msg, GN
193 193
194 put_type = ntohs(put_msg->type); 194 put_type = ntohs(put_msg->type);
195 data_size = ntohs(put_msg->data_size); 195 data_size = ntohs(put_msg->data_size);
196#if DEBUG_DHT
197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
198 "`%s': %s msg total size is %d, data size %d, struct size %d\n", "DHT", "PUT", ntohs(put_msg->header.size), data_size, sizeof(struct GNUNET_DHT_PutMessage));
199#endif
196 GNUNET_assert(ntohs(put_msg->header.size) == sizeof(struct GNUNET_DHT_PutMessage) + data_size); 200 GNUNET_assert(ntohs(put_msg->header.size) == sizeof(struct GNUNET_DHT_PutMessage) + data_size);
197 data = GNUNET_malloc(data_size); 201 data = GNUNET_malloc(data_size);
198 memcpy(data, &put_msg[1], data_size); 202 memcpy(data, &put_msg[1], data_size);
@@ -202,6 +206,7 @@ static void handle_dht_put (void *cls, struct GNUNET_DHT_PutMessage *put_msg, GN
202 "`%s': Received `%s' request from client, message type %d, key %s\n", "DHT", "PUT", put_type, GNUNET_h2s(key)); 206 "`%s': Received `%s' request from client, message type %d, key %s\n", "DHT", "PUT", put_type, GNUNET_h2s(key));
203#endif 207#endif
204 208
209
205 /** 210 /**
206 * FIXME: Implement dht put request functionality here! 211 * FIXME: Implement dht put request functionality here!
207 */ 212 */
@@ -250,6 +255,10 @@ send_client_receipt_confirmation(struct GNUNET_SERVER_Client *client, uint64_t u
250{ 255{
251 struct GNUNET_DHT_StopMessage *confirm_message; 256 struct GNUNET_DHT_StopMessage *confirm_message;
252 257
258#if DEBUG_DHT
259 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
260 "`%s': Sending receipt confirmation for uid %llu\n", "DHT", uid);
261#endif
253 confirm_message = GNUNET_malloc(sizeof(struct GNUNET_DHT_StopMessage)); 262 confirm_message = GNUNET_malloc(sizeof(struct GNUNET_DHT_StopMessage));
254 confirm_message->header.type = htons(GNUNET_MESSAGE_TYPE_DHT_STOP); 263 confirm_message->header.type = htons(GNUNET_MESSAGE_TYPE_DHT_STOP);
255 confirm_message->header.size = htons(sizeof(struct GNUNET_DHT_StopMessage)); 264 confirm_message->header.size = htons(sizeof(struct GNUNET_DHT_StopMessage));
@@ -287,6 +296,7 @@ handle_dht_start_message(void *cls, struct GNUNET_SERVER_Client * client,
287 break; 296 break;
288 case GNUNET_MESSAGE_TYPE_DHT_PUT: 297 case GNUNET_MESSAGE_TYPE_DHT_PUT:
289 handle_dht_put(cls, (struct GNUNET_DHT_PutMessage *)enc_msg, &dht_msg->key); 298 handle_dht_put(cls, (struct GNUNET_DHT_PutMessage *)enc_msg, &dht_msg->key);
299 send_client_receipt_confirmation(client, GNUNET_ntohll(dht_msg->unique_id));
290 break; 300 break;
291 case GNUNET_MESSAGE_TYPE_DHT_FIND_PEER: 301 case GNUNET_MESSAGE_TYPE_DHT_FIND_PEER:
292 handle_dht_find_peer(cls, (struct GNUNET_DHT_FindPeerMessage *)enc_msg, &dht_msg->key); 302 handle_dht_find_peer(cls, (struct GNUNET_DHT_FindPeerMessage *)enc_msg, &dht_msg->key);