[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4070 - GNUnet/src/applications/dht/module
From: |
grothoff |
Subject: |
[GNUnet-SVN] r4070 - GNUnet/src/applications/dht/module |
Date: |
Tue, 26 Dec 2006 23:09:23 -0800 (PST) |
Author: grothoff
Date: 2006-12-26 23:09:22 -0800 (Tue, 26 Dec 2006)
New Revision: 4070
Modified:
GNUnet/src/applications/dht/module/cs.c
GNUnet/src/applications/dht/module/service.c
Log:
fix
Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c 2006-12-27 06:59:05 UTC (rev
4069)
+++ GNUnet/src/applications/dht/module/cs.c 2006-12-27 07:09:22 UTC (rev
4070)
@@ -33,6 +33,8 @@
#include "dht.h"
#include "gnunet_dht_service.h"
+#define DEBUG_CS YES
+
/**
* Global core API.
*/
@@ -77,6 +79,16 @@
- sizeof(CS_dht_request_put_MESSAGE);
GE_ASSERT(NULL,
size < MAX_BUFFER_SIZE);
+#if DEBUG_CS
+ GE_LOG(coreAPI->ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "`%s' at %s:%d processes put '%.*s'\n",
+ __FUNCTION__,
+ __FILE__,
+ __LINE__,
+ size,
+ &req[1]);
+#endif
dhtAPI->put(&req->key,
ntohl(req->type),
size,
@@ -106,6 +118,7 @@
memcpy(&msg[1],
&value[1],
ntohl(value->size) - sizeof(DataContainer));
+#if DEBUG_CS
GE_LOG(coreAPI->ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
"`%s' at %s:%d processes reply '%.*s'\n",
@@ -114,6 +127,7 @@
__LINE__,
ntohl(value->size) - sizeof(DataContainer),
&value[1]);
+#endif
if (OK != coreAPI->sendToClient(record->client,
&msg->header)) {
GE_LOG(coreAPI->ectx,
@@ -156,6 +170,14 @@
GE_BREAK(NULL, 0);
return SYSERR;
}
+#if DEBUG_CS
+ GE_LOG(coreAPI->ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "`%s' at %s:%d processes get\n",
+ __FUNCTION__,
+ __FILE__,
+ __LINE__);
+#endif
get = (const CS_dht_request_get_MESSAGE *) message;
cpc = MALLOC(sizeof(DHT_CLIENT_GET_RECORD));
cpc->client = client;
Modified: GNUnet/src/applications/dht/module/service.c
===================================================================
--- GNUnet/src/applications/dht/module/service.c 2006-12-27 06:59:05 UTC
(rev 4069)
+++ GNUnet/src/applications/dht/module/service.c 2006-12-27 07:09:22 UTC
(rev 4070)
@@ -42,11 +42,6 @@
HashCode512 key;
/**
- * Semaphore used to signal completion of timeout cron job.
- */
- struct SEMAPHORE * sem;
-
- /**
* Function to call for each result.
*/
DataProcessor callback;
@@ -99,7 +94,6 @@
struct DHT_GET_RECORD * rec = cls;
rec->callbackComplete(rec->closure);
- SEMAPHORE_UP(rec->sem);
}
/**
@@ -113,9 +107,11 @@
* @param table table to use for the lookup
* @param key the key to look up
* @param timeout how long to wait until this operation should
- * automatically time-out -- FIXME: not yet supported!
+ * automatically time-out
* @param callback function to call on each result
* @param closure extra argument to callback
+ * @param callbackComplete function called on time-out
+ * (but not on explicit async_stop).
* @return handle to stop the async get
*/
static struct DHT_GET_RECORD *
@@ -130,7 +126,6 @@
ret = MALLOC(sizeof(DHT_GET_RECORD));
ret->key = *key;
- ret->sem = SEMAPHORE_CREATE(0);
ret->callback = callback;
ret->cls = cls;
ret->callbackComplete = callbackComplete;
@@ -153,17 +148,18 @@
*/
static int
dht_get_async_stop(struct DHT_GET_RECORD * record) {
+ cron_suspend(coreAPI->cron,
+ YES);
+ cron_del_job(coreAPI->cron,
+ &timeout_callback,
+ 0,
+ record);
+ cron_resume_jobs(coreAPI->cron,
+ YES);
dht_get_stop(&record->key,
record->type,
&client_result_converter,
record);
- cron_advance_job(coreAPI->cron,
- &timeout_callback,
- 0,
- record);
- /* wait for cron-job to complete! */
- SEMAPHORE_DOWN(record->sem, YES);
- SEMAPHORE_DESTROY(record->sem);
FREE(record);
return OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4070 - GNUnet/src/applications/dht/module,
grothoff <=