[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3453 - in GNUnet/src: applications/dht/module applications
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3453 - in GNUnet/src: applications/dht/module applications/dht/tools transports |
Date: |
Sun, 8 Oct 2006 12:41:44 -0700 (PDT) |
Author: grothoff
Date: 2006-10-08 12:41:41 -0700 (Sun, 08 Oct 2006)
New Revision: 3453
Modified:
GNUnet/src/applications/dht/module/cs.c
GNUnet/src/applications/dht/module/dht.c
GNUnet/src/applications/dht/tools/dht_api.c
GNUnet/src/transports/tcp_helper.c
Log:
bugfixes - including tcp memory leak
Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c 2006-10-08 19:33:54 UTC (rev
3452)
+++ GNUnet/src/applications/dht/module/cs.c 2006-10-08 19:41:41 UTC (rev
3453)
@@ -522,8 +522,9 @@
putRecordsSize+1);
putRecords[putRecordsSize-1] = ptr;
MUTEX_UNLOCK(csLock);
- GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
- "Starting DHT put\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_REQUEST | GE_USER,
+ "Starting DHT put\n");
ptr->put_record = dhtAPI->put_start(&req->table,
&req->key,
ntohll(req->timeout),
Modified: GNUnet/src/applications/dht/module/dht.c
===================================================================
--- GNUnet/src/applications/dht/module/dht.c 2006-10-08 19:33:54 UTC (rev
3452)
+++ GNUnet/src/applications/dht/module/dht.c 2006-10-08 19:41:41 UTC (rev
3453)
@@ -658,7 +658,7 @@
/**
* List of the tables that this peer participates in.
*/
-static LocalTableData * tables;
+static LocalTableData ** tables;
/**
* Number of entries in the tables array.
@@ -784,8 +784,8 @@
int i;
for (i=tablesCount-1;i>=0;i--)
if (equalsHashCode512(id,
- &tables[i].id))
- return &tables[i];
+ &tables[i]->id))
+ return tables[i];
return NULL;
}
@@ -1067,7 +1067,7 @@
tc = tablesCount;
tabs = MALLOC(sizeof(DHT_TableId) * tc);
for (i=0;i<tc;i++)
- tabs[i] = tables[i].id;
+ tabs[i] = tables[i]->id;
MUTEX_UNLOCK(lock);
s = RPC_paramSize(args) + sizeof(DHT_TableId) * tc;
/* always add if resulting size is less than 1k;
@@ -2755,7 +2755,7 @@
ENTER();
MUTEX_LOCK(lock);
for (i=0;i<tablesCount;i++) {
- if (equalsDHT_TableId(&tables[i].id, table)) {
+ if (equalsDHT_TableId(&tables[i]->id, table)) {
MUTEX_UNLOCK(lock);
return SYSERR;
}
@@ -2763,8 +2763,9 @@
GROW(tables,
tablesCount,
tablesCount+1);
- tables[tablesCount-1].id = *table;
- tables[tablesCount-1].store = datastore;
+ tables[tablesCount-1] = MALLOC(sizeof(LocalTableData));
+ tables[tablesCount-1]->id = *table;
+ tables[tablesCount-1]->store = datastore;
MUTEX_UNLOCK(lock);
return OK;
}
@@ -2781,14 +2782,14 @@
static int dht_leave(const DHT_TableId * table) {
int i;
int idx;
- LocalTableData old;
+ LocalTableData * old;
DHT_REMOVE_RECORD * remRec;
ENTER();
MUTEX_LOCK(lock);
idx = -1;
for (i=0;i<tablesCount;i++) {
- if (equalsDHT_TableId(&tables[i].id, table)) {
+ if (equalsDHT_TableId(&tables[i]->id, table)) {
idx = i;
break;
}
@@ -2803,6 +2804,7 @@
GROW(tables,
tablesCount,
tablesCount-1);
+ FREE(old);
MUTEX_UNLOCK(lock);
if (! equalsHashCode512(&masterTableId,
table)) {
@@ -3071,7 +3073,6 @@
fw_context,
(DHT_OP_Complete) &rpc_dht_findValue_complete,
fw_context);
- RPC_paramFree(arguments);
addAbortJob((CronJob)&rpc_DHT_findValue_abort,
fw_context);
cron_add_job(coreAPI->cron,
@@ -3079,6 +3080,7 @@
ntohll(*timeout),
0,
fw_context);
+ RPC_paramFree(arguments);
}
/**
@@ -3213,7 +3215,6 @@
value,
(DHT_OP_Complete) &rpc_dht_store_callback,
fw_context);
- RPC_paramFree(arguments);
addAbortJob(&rpc_DHT_store_abort,
fw_context);
cron_add_job(coreAPI->cron,
@@ -3221,6 +3222,7 @@
ntohll(*timeout),
0,
fw_context);
+ RPC_paramFree(arguments);
FREE(value);
}
@@ -3363,7 +3365,6 @@
value,
(DHT_OP_Complete) &rpc_dht_remove_callback,
fw_context);
- RPC_paramFree(arguments);
addAbortJob((CronJob)&rpc_DHT_remove_abort,
fw_context);
cron_add_job(coreAPI->cron,
@@ -3371,6 +3372,7 @@
ntohll(*timeout),
0,
fw_context);
+ RPC_paramFree(arguments);
FREE(value);
}
@@ -3480,9 +3482,9 @@
#endif
for (i=0;i<tablesCount;i++) {
- if (tables[i].lastMasterAdvertisement + DHT_MAINTAIN_BUCKET_FREQUENCY <
now) {
- tables[i].lastMasterAdvertisement = now;
- if (equalsHashCode512(&tables[i].id,
+ if (tables[i]->lastMasterAdvertisement + DHT_MAINTAIN_BUCKET_FREQUENCY <
now) {
+ tables[i]->lastMasterAdvertisement = now;
+ if (equalsHashCode512(&tables[i]->id,
&masterTableId))
continue;
GROW(putRecords,
@@ -3493,7 +3495,7 @@
putTimesSize+1);
putRecords[putRecordsSize-1]
= dht_put_async_start(&masterTableId,
- &tables[i].id,
+ &tables[i]->id,
DHT_MAINTAIN_BUCKET_FREQUENCY,
value,
NULL,
@@ -3513,8 +3515,8 @@
__FUNCTION__);
#endif
for (i=0;i<tablesCount;i++) {
- if (tables[i].lastFindOperation + DHT_MAINTAIN_FIND_FREQUENCY < now) {
- tables[i].lastFindOperation = now;
+ if (tables[i]->lastFindOperation + DHT_MAINTAIN_FIND_FREQUENCY < now) {
+ tables[i]->lastFindOperation = now;
GROW(findRecords,
findRecordsSize,
findRecordsSize+1);
@@ -3522,7 +3524,7 @@
findTimesSize,
findTimesSize+1);
findRecords[findRecordsSize-1]
- = findNodes_start(&tables[i].id,
+ = findNodes_start(&tables[i]->id,
&coreAPI->myIdentity->hashPubKey,
DHT_MAINTAIN_FIND_FREQUENCY);
findTimes[findTimesSize-1] = now;
Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2006-10-08 19:33:54 UTC (rev
3452)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2006-10-08 19:41:41 UTC (rev
3453)
@@ -163,7 +163,8 @@
* Thread that processes requests from gnunetd (by forwarding
* them to the implementation of list->store).
*/
-static void * process_thread(TableList * list) {
+static void * process_thread(void * cls) {
+ TableList * list = cls;
MESSAGE_HEADER * buffer;
MESSAGE_HEADER * reply;
CS_dht_request_join_MESSAGE req;
@@ -487,9 +488,9 @@
return SYSERR;
}
list->lock = MUTEX_CREATE(NO);
- list->processor = PTHREAD_CREATE((PThreadMain)&process_thread,
+ list->processor = PTHREAD_CREATE(&process_thread,
list,
- 16 * 1024);
+ 32 * 1024);
if (list->processor == NULL) {
GE_LOG_STRERROR(ectx,
GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
@@ -588,7 +589,8 @@
MUTEX_UNLOCK(list->lock);
unused = NULL;
PTHREAD_JOIN(list->processor, &unused);
- connection_destroy(list->sock);
+ if (list->sock != NULL)
+ connection_destroy(list->sock);
MUTEX_DESTROY(list->lock);
FREE(list);
return ret;
Modified: GNUnet/src/transports/tcp_helper.c
===================================================================
--- GNUnet/src/transports/tcp_helper.c 2006-10-08 19:33:54 UTC (rev 3452)
+++ GNUnet/src/transports/tcp_helper.c 2006-10-08 19:41:41 UTC (rev 3453)
@@ -255,6 +255,7 @@
struct SelectHandle * sh,
struct SocketHandle * sock,
void * sock_ctx) {
+ FREE(sock_ctx);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3453 - in GNUnet/src: applications/dht/module applications/dht/tools transports,
grothoff <=