[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5188 - in GNUnet: . src/applications/datastore src/applica
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5188 - in GNUnet: . src/applications/datastore src/applications/dstore src/applications/sqstore_sqlite src/include src/server src/util/containers |
Date: |
Sat, 30 Jun 2007 05:37:05 -0600 (MDT) |
Author: grothoff
Date: 2007-06-30 05:37:04 -0600 (Sat, 30 Jun 2007)
New Revision: 5188
Modified:
GNUnet/ChangeLog
GNUnet/README
GNUnet/UPDATING
GNUnet/configure.ac
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/datastore/filter.c
GNUnet/src/applications/dstore/Makefile.am
GNUnet/src/applications/dstore/dstore.c
GNUnet/src/applications/sqstore_sqlite/sqlite.c
GNUnet/src/include/gnunet_dstore_service.h
GNUnet/src/server/connection.c
GNUnet/src/util/containers/bloomfilter.c
GNUnet/todo
Log:
improving bloomfilters, version bump -- required for bloomfilter change -- and
possible fix of a disconnect issue that was recently introduced
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2007-06-30 04:56:01 UTC (rev 5187)
+++ GNUnet/ChangeLog 2007-06-30 11:37:04 UTC (rev 5188)
@@ -1,3 +1,8 @@
+Sat Jun 30 01:55:34 MDT 2007
+ Improved bloomfilter recomputation after quota change.
+ Fixed bloomfilter size computation. You must run
+ gnunet-update (will take a while).
+
Fri Jun 29 00:56:03 MDT 2007
Avoid re-connecting shortly after connection was shutdown.
Modified: GNUnet/README
===================================================================
--- GNUnet/README 2007-06-30 04:56:01 UTC (rev 5187)
+++ GNUnet/README 2007-06-30 11:37:04 UTC (rev 5188)
@@ -30,9 +30,10 @@
- libgcrypt >= 1.2
- libgmp >= 4.0
- libcurl >= 7.x
-- mysql >= 5.0 OR sqlite >= 3.0
+- sqlite >= 3.0
- libltdl >= 1.5 (part of GNU libtool)
- libguile >= 1.8 (strongly recommended)
+- mysql >= 5.0 (recommended)
- GNU adns >= 1.0 (recommended)
Modified: GNUnet/UPDATING
===================================================================
--- GNUnet/UPDATING 2007-06-30 04:56:01 UTC (rev 5187)
+++ GNUnet/UPDATING 2007-06-30 11:37:04 UTC (rev 5188)
@@ -8,6 +8,19 @@
data-preserving migration may not be possible. For SVN versions,
you're on your own.
+0.7.2 to 0.7.2a
+===============
+
+Run
+
+$ gnunet-update
+
+This may take a bit longer than usual (depending on your database
+size, it may take a few hours -- gnunet-update will iterate once over
+all entries in the database). You will have to upgrade gnunet-gtk
+and/or gnunet-qt as well.
+
+
0.7.1c to 0.7.2
===============
@@ -53,8 +66,8 @@
of the change.
-0.7.1 to 0.7.1a
-===============
+0.7.1pre0, 0.7.1pre1, 0.7.1pre2 and 0.7.1 to 0.7.1a
+===================================================
Run
@@ -63,36 +76,6 @@
(as the same user that also runs gnunetd).
-0.7.1pre2 to 0.7.1
-==================
-
-Run
-
-$ gnunet-update
-
-(as the same user that also runs gnunetd).
-
-
-0.7.1pre1 to 0.7.1pre2
-======================
-
-Run
-
-$ gnunet-update
-
-(as the same user that also runs gnunetd).
-
-
-0.7.1pre0 to 0.7.1pre1
-======================
-
-Run
-
-$ gnunet-update
-
-(as the same user that also runs gnunetd).
-
-
0.7.0e to 0.7.1pre0
===================
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2007-06-30 04:56:01 UTC (rev 5187)
+++ GNUnet/configure.ac 2007-06-30 11:37:04 UTC (rev 5188)
@@ -1,5 +1,5 @@
# This file is part of GNUnet.
-# (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
+# (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Christian Grothoff (and other
contributing authors)
#
# GNUnet is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
@@ -22,7 +22,7 @@
#
AC_PREREQ(2.57)
AC_INIT([GNUnet], [0.7.2],address@hidden)
-AM_INIT_AUTOMAKE([GNUnet], [0.7.2])
+AM_INIT_AUTOMAKE([GNUnet], [0.7.2a])
AM_CONFIG_HEADER([config.h])
AH_TOP([#define _GNU_SOURCE 1])
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2007-06-30 04:56:01 UTC
(rev 5187)
+++ GNUnet/src/applications/datastore/datastore.c 2007-06-30 11:37:04 UTC
(rev 5188)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
+ (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Christian Grothoff (and
other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -66,6 +66,13 @@
static struct CronManager * cron;
+static Stats_ServiceAPI * stats;
+
+static int stat_filtered;
+
+static int stat_filter_failed;
+
+
/**
* Require 1/100th of quota to be 'free' space.
*/
@@ -75,14 +82,12 @@
return sq->getSize();
}
-static int fastGet(const HashCode512 * query) {
- return testAvailable(query);
-}
-
static int get(const HashCode512 * query,
unsigned int type,
Datum_Iterator iter,
void * closure) {
+ int ret;
+
if (! testAvailable(query)) {
#if DEBUG_DATASTORE
EncName enc;
@@ -96,12 +101,18 @@
"Datastore availability pre-test failed for `%s'.\n",
&enc);
#endif
+ if (stats != NULL)
+ stats->change(stat_filtered, 1);
return 0;
}
- return sq->get(query,
- type,
- iter,
- closure);
+ ret = sq->get(query,
+ type,
+ iter,
+ closure);
+ if ( (ret == 0) &&
+ (stats != NULL) )
+ stats->change(stat_filter_failed, 1);
+ return ret;
}
/**
@@ -358,9 +369,8 @@
provide_module_datastore(CoreAPIForApplication * capi) {
static Datastore_ServiceAPI api;
unsigned long long lquota;
- unsigned int sqot;
+ unsigned long long sqot;
State_ServiceAPI * state;
- Stats_ServiceAPI * stats;
if (-1 == GC_get_configuration_value_number(capi->cfg,
"FS",
@@ -376,16 +386,18 @@
= lquota * 1024 * 1024; /* MB to bytes */
stats = capi->requestService("stats");
if (stats != NULL) {
+ stat_filtered = stats->create(gettext_noop("# requests filtered by bloom
filter"));
+ stat_filter_failed = stats->create(gettext_noop("# bloom filter false
positives"));
+
stats->set(stats->create(gettext_noop("# bytes allowed in datastore")),
quota);
- capi->releaseService(stats);
}
state = capi->requestService("state");
if (state != NULL) {
- sqot = htonl(lquota);
+ sqot = htonll(lquota);
state->write(capi->ectx,
"FS-LAST-QUOTA",
- sizeof(unsigned int),
+ sizeof(unsigned long long),
&sqot);
capi->releaseService(state);
} else {
@@ -395,6 +407,10 @@
}
sq = capi->requestService("sqstore");
if (sq == NULL) {
+ if (stats != NULL) {
+ capi->releaseService(stats);
+ stats = NULL;
+ }
GE_BREAK(capi->ectx, 0);
return NULL;
}
@@ -407,6 +423,10 @@
GE_BREAK(capi->ectx, 0);
donePrefetch();
capi->releaseService(sq);
+ if (stats != NULL) {
+ capi->releaseService(stats);
+ stats = NULL;
+ }
return NULL;
}
available = quota - sq->getSize();
@@ -419,7 +439,7 @@
cron_start(cron);
api.getSize = &getSize;
api.put = &put;
- api.fast_get = &fastGet;
+ api.fast_get = &testAvailable;
api.putUpdate = &putUpdate;
api.get = &get;
api.getRandom = &getRandom; /* in prefetch.c */
@@ -442,6 +462,10 @@
donePrefetch();
doneFilters();
coreAPI->releaseService(sq);
+ if (stats != NULL) {
+ coreAPI->releaseService(stats);
+ stats = NULL;
+ }
sq = NULL;
coreAPI = NULL;
}
@@ -464,8 +488,8 @@
*/
void update_module_datastore(UpdateAPI * uapi) {
unsigned long long quota;
- unsigned int lastQuota;
- int * lq;
+ unsigned long long lastQuota;
+ unsigned long long * lq;
State_ServiceAPI * state;
if (-1 == GC_get_configuration_value_number(uapi->cfg,
@@ -477,25 +501,17 @@
"a))
return; /* OOPS */
state = uapi->requestService("state");
- if (state != NULL) {
- lq = NULL;
- if (sizeof(int) != state->read(uapi->ectx,
- "FS-LAST-QUOTA",
- (void**)&lq)) {
- uapi->releaseService(state);
- return; /* first start? */
- }
+ lq = NULL;
+ if ( (state != NULL) &&
+ (sizeof(unsigned long long) != state->read(uapi->ectx,
+ "FS-LAST-QUOTA",
+ (void**)&lq)) &&
+ (ntohll(*lq) == quota) ) {
uapi->releaseService(state);
- lastQuota = ntohl(*lq);
FREE(lq);
- if (lastQuota == quota)
- return; /* unchanged */
- } else {
- GE_LOG(uapi->ectx,
- GE_USER | GE_ADMIN | GE_ERROR | GE_BULK,
- _("Failed to load state service. Trying to do without.\n"));
+ return; /* no change */
}
-
+ FREENONNULL(lq);
/* ok, need to convert! */
deleteFilter(uapi->ectx,
uapi->cfg);
@@ -503,10 +519,8 @@
uapi->cfg);
sq = uapi->requestService("sqstore");
if (sq != NULL) {
- sq->get(NULL,
- ANY_BLOCK,
- &filterAddAll,
- NULL);
+ sq->iterateAllNow(&filterAddAll,
+ NULL);
uapi->releaseService(sq);
} else {
GE_LOG(uapi->ectx,
@@ -515,6 +529,14 @@
}
sq = NULL;
doneFilters();
+ if (state != NULL) {
+ lastQuota = htonll(quota);
+ state->write(uapi->ectx,
+ "FS-LAST-QUOTA",
+ sizeof(unsigned long long),
+ &lastQuota);
+ uapi->releaseService(state);
+ }
}
Modified: GNUnet/src/applications/datastore/filter.c
===================================================================
--- GNUnet/src/applications/datastore/filter.c 2007-06-30 04:56:01 UTC (rev
5187)
+++ GNUnet/src/applications/datastore/filter.c 2007-06-30 11:37:04 UTC (rev
5188)
@@ -75,7 +75,7 @@
"a))
return SYSERR;
quota *= 1024;
- bf_size = quota/8/32; /* 8 bit per entry, 1 bit per 32 kb in DB */
+ bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
bf = getFilterName(ectx, cfg);
if (bf == NULL)
return SYSERR;
Modified: GNUnet/src/applications/dstore/Makefile.am
===================================================================
--- GNUnet/src/applications/dstore/Makefile.am 2007-06-30 04:56:01 UTC (rev
5187)
+++ GNUnet/src/applications/dstore/Makefile.am 2007-06-30 11:37:04 UTC (rev
5188)
@@ -22,6 +22,7 @@
$(SQLITE_LDFLAGS)
libgnunetmodule_dstore_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/containers/libgnunetutil_containers.la \
-lsqlite3
EXTRA_DIST = check.conf
Modified: GNUnet/src/applications/dstore/dstore.c
===================================================================
--- GNUnet/src/applications/dstore/dstore.c 2007-06-30 04:56:01 UTC (rev
5187)
+++ GNUnet/src/applications/dstore/dstore.c 2007-06-30 11:37:04 UTC (rev
5188)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2006 Christian Grothoff (and other contributing authors)
+ (C) 2006, 2007 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -25,13 +25,11 @@
* @todo Indexes, statistics
*
* Database: SQLite
- *
- * TODO:
- * - add bloomfilter to reduce disk IO
*/
#include "platform.h"
#include "gnunet_util.h"
+#include "gnunet_util_containers.h"
#include "gnunet_dstore_service.h"
#include "gnunet_stats_service.h"
#include <sqlite3.h>
@@ -74,6 +72,10 @@
*/
#define OVERHEAD ((4+4+8+8*2+sizeof(HashCode512)*2+32))
+struct Bloomfilter * bloom;
+
+static char * bloom_name;
+
/**
* @brief Prepare a SQL statement
*/
@@ -188,6 +190,7 @@
return SYSERR;
}
dcontent = MALLOC(MAX_CONTENT_SIZE);
+ err = SQLITE_DONE;
while ( (payload * 10 > quota * 9) && /* we seem to be about 10% off */
((err = sqlite3_step(stmt)) == SQLITE_ROW) ) {
dsize = sqlite3_column_int(stmt, 0);
@@ -267,12 +270,13 @@
sqlite3_finalize(dstmt);
sqlite3_finalize(stmt);
if (payload * 10 > quota * 9) {
+ /* we seem to be about 10% off */
GE_LOG(coreAPI->ectx,
GE_ERROR | GE_BULK | GE_DEVELOPER,
"Failed to delete content to drop below quota (bug?).\n",
payload,
quota);
- return SYSERR; /* we seem to be about 10% off */
+ return SYSERR;
}
return OK;
}
@@ -355,8 +359,10 @@
MUTEX_UNLOCK(lock);
return OK;
}
+ if (bloom != NULL)
+ addToBloomfilter(bloom,
+ key);
-
if (OK != checkQuota(dbh)) {
sqlite3_close(dbh);
MUTEX_UNLOCK(lock);
@@ -441,6 +447,12 @@
unsigned int cnt;
MUTEX_LOCK(lock);
+ if ( (bloom != NULL) &&
+ (NO == testBloomfilter(bloom,
+ key)) ) {
+ MUTEX_UNLOCK(lock);
+ return 0;
+ }
if ( (fn == NULL) ||
(SQLITE_OK != sqlite3_open(fn,
&dbh)) ) {
@@ -503,6 +515,7 @@
Dstore_ServiceAPI *
provide_module_dstore(CoreAPIForApplication * capi) {
static Dstore_ServiceAPI api;
+ int fd;
#if DEBUG_SQLITE
GE_LOG(capi->ectx,
@@ -512,6 +525,8 @@
if (OK != db_reset())
return NULL;
lock = MUTEX_CREATE(NO);
+
+
coreAPI = capi;
api.get = &d_get;
api.put = &d_put;
@@ -525,6 +540,16 @@
if (quota == 0) /* error */
quota = 1;
quota *= 1024 * 1024;
+
+ bloom_name = STRDUP("/tmp/dbloomXXXXXX");
+ fd = mkstemp(fn);
+ bloom = loadBloomfilter(coreAPI->ectx,
+ fn,
+ quota / (OVERHEAD + 1024), /* 8 bit per entry in DB,
expect 1k entries */
+ 5);
+ CLOSE(fd);
+
+
stats = capi->requestService("stats");
if (stats != NULL)
stat_dstore_size = stats->create(gettext_noop("# bytes in dstore"));
@@ -538,6 +563,13 @@
UNLINK(fn);
FREE(fn);
fn = NULL;
+ if (bloom != NULL) {
+ freeBloomfilter(bloom);
+ bloom = NULL;
+ }
+ UNLINK(bloom_name);
+ FREE(bloom_name);
+ bloom_name = NULL;
if (stats != NULL) {
coreAPI->releaseService(stats);
stats = NULL;
Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-06-30 04:56:01 UTC
(rev 5187)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c 2007-06-30 11:37:04 UTC
(rev 5188)
@@ -113,7 +113,7 @@
/**
* bytes used
*/
- double payload;
+ unsigned long long payload;
unsigned int lastSync;
@@ -485,7 +485,7 @@
*/
static int setStat(sqliteHandle * handle,
const char *key,
- double val) {
+ unsigned long long val) {
sqlite3_stmt *stmt;
sqlite3 * dbh;
@@ -510,9 +510,9 @@
key,
strlen(key),
SQLITE_STATIC);
- sqlite3_bind_double(stmt,
- 2,
- val);
+ sqlite3_bind_int64(stmt,
+ 2,
+ val);
sqlite3_bind_int(stmt,
3,
RESERVED_BLOCK);
@@ -819,7 +819,9 @@
sqlite3 * dbh;
sqliteHandle * handle;
int ret;
+ unsigned long long payload;
+ payload = 0;
handle = getDBHandle();
dbh = handle->dbh;
/* For the rowid trick see
@@ -838,6 +840,7 @@
stmt);
if (datum == NULL)
continue;
+ payload += getContentDatastoreSize(&datum->value);
if (iter != NULL) {
if (SYSERR == iter(&datum->key,
&datum->value,
@@ -858,6 +861,16 @@
return SYSERR;
}
sqlite3_finalize(stmt);
+ if (count != SYSERR) {
+ /* re-computed payload! */
+ GE_LOG(ectx,
+ GE_INFO | GE_IMMEDIATE | GE_USER | GE_ADMIN,
+ "SQLite database size recomputed. New estimate is %llu, old
estimate was %llu\n",
+ payload,
+ db->payload);
+ db->payload = payload;
+ syncStats(handle);
+ }
return count;
}
@@ -868,8 +881,7 @@
unsigned int idx;
#if DEBUG_SQLITE
- GE_LOG(
- ectx,
+ GE_LOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
"SQLite: closing database\n");
#endif
Modified: GNUnet/src/include/gnunet_dstore_service.h
===================================================================
--- GNUnet/src/include/gnunet_dstore_service.h 2007-06-30 04:56:01 UTC (rev
5187)
+++ GNUnet/src/include/gnunet_dstore_service.h 2007-06-30 11:37:04 UTC (rev
5188)
@@ -20,13 +20,12 @@
/**
* @file include/gnunet_dstore_service.h
- * @brief An SQ store is responsible for storing blocks with
- * additional indices that allow traversing the store in
- * order of expiration time or priority, in addition to
- * queries by key and block type. The name comes from SQL,
- * because using an SQL database to do this should be
- * particularly easy. But that is of course not the only
- * way to implement an dstore.
+ * @brief dstore is a simple persistent hash table
+ * of bounded size with content expiration
+ * In contrast to the sqstore there is
+ * no prioritization, deletion or iteration.
+ * Furthermore, all of the data is
+ * discarded when the peer shuts down!
* @author Christian Grothoff
*/
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2007-06-30 04:56:01 UTC (rev 5187)
+++ GNUnet/src/server/connection.c 2007-06-30 11:37:04 UTC (rev 5188)
@@ -106,6 +106,14 @@
#define ADMIN_PRIORITY 0xFFFF
/**
+ * How long should we blacklist a peer after a
+ * disconnect? This value should probably be
+ * increased in the future (once more peers
+ * run versions beyond 0.7.2a.
+ */
+#define SECONDS_BLACKLIST_AFTER_DISCONNECT 300
+
+/**
* If we under-shoot our bandwidth limitation in one time period, how
* much of that limit are we allowed to 'roll-over' into the next
* period? The number given here is a factor of the total per-minute
@@ -2467,7 +2475,7 @@
be->idealized_limit = MIN_BPM_PER_PEER;
/* do not try to reconnect any time soon! */
identity->blacklistHost(&be->session.sender,
- 60 * 60, /* wait at least 1h */
+ SECONDS_BLACKLIST_AFTER_DISCONNECT,
YES);
shutdownConnection(be);
} else {
@@ -2563,7 +2571,7 @@
#endif
/* do not try to reconnect any time soon! */
identity->blacklistHost(&root->session.sender,
- 60 * 60, /* wait at least 1h */
+ SECONDS_BLACKLIST_AFTER_DISCONNECT,
YES);
shutdownConnection(root);
@@ -2626,7 +2634,7 @@
#endif
/* do not try to reconnect any time soon! */
identity->blacklistHost(&root->session.sender,
- 60 * 60, /* wait at least 1h */
+ SECONDS_BLACKLIST_AFTER_DISCONNECT,
YES);
shutdownConnection(root);
}
@@ -2844,7 +2852,7 @@
}
/* do not try to reconnect any time soon! */
identity->blacklistHost(&be->session.sender,
- 60 * 60, /* wait at least 1h */
+ SECONDS_BLACKLIST_AFTER_DISCONNECT,
YES);
shutdownConnection(be);
MUTEX_UNLOCK(lock);
@@ -3731,7 +3739,7 @@
#endif
/* do not try to reconnect any time soon! */
identity->blacklistHost(&be->session.sender,
- 60 * 60, /* wait at least 1h */
+ SECONDS_BLACKLIST_AFTER_DISCONNECT,
YES);
shutdownConnection(be);
}
Modified: GNUnet/src/util/containers/bloomfilter.c
===================================================================
--- GNUnet/src/util/containers/bloomfilter.c 2007-06-30 04:56:01 UTC (rev
5187)
+++ GNUnet/src/util/containers/bloomfilter.c 2007-06-30 11:37:04 UTC (rev
5188)
@@ -156,9 +156,9 @@
unsigned int targetLoc;
setBit(bitArray, bitIdx);
- /* Update the counter file on disk */
- GE_ASSERT(NULL,
- fd != -1);
+ if (fd == -1)
+ return;
+ /* Update the counter file on disk */
fileSlot = bitIdx / 2;
targetLoc = bitIdx % 2;
@@ -210,24 +210,25 @@
unsigned int low;
unsigned int targetLoc;
+ if (fd == -1)
+ return; /* cannot decrement! */
GE_ASSERT(NULL, fd != -1);
/* Each char slot in the counter file holds two 4 bit counters */
fileSlot = bitIdx / 2;
targetLoc = bitIdx % 2;
-
lseek(fd, fileSlot, SEEK_SET);
value = 0;
READ(fd, &value, 1);
-
+
low = value & 0xF;
high = (value & 0xF0) >> 4;
-
+
/* decrement, but once we have reached the max, never go back! */
if (targetLoc == 0) {
if ( (low > 0) && (low < 0xF) )
low--;
if (low == 0) {
- clearBit(bitArray, bitIdx);
+ clearBit(bitArray, bitIdx);
}
} else {
if ( (high > 0) && (high < 0xF) )
@@ -411,8 +412,7 @@
int i;
unsigned int ui;
- if ( (filename == NULL) ||
- (k==0) ||
+ if ( (k==0) ||
(size==0) )
return NULL;
if (size < BUFFSIZE)
@@ -425,22 +425,27 @@
bf = MALLOC(sizeof(Bloomfilter));
bf->ectx = ectx;
/* Try to open a bloomfilter file */
+ if (filename != NULL) {
#ifndef _MSC_VER
- bf->fd = disk_file_open(ectx,
- filename,
- O_RDWR|O_CREAT,
- S_IRUSR|S_IWUSR);
+ bf->fd = disk_file_open(ectx,
+ filename,
+ O_RDWR|O_CREAT,
+ S_IRUSR|S_IWUSR);
#else
- bf->fd = disk_file_open(ectx,
- filename,
- O_WRONLY|O_CREAT,
- S_IREAD|S_IWRITE);
+ bf->fd = disk_file_open(ectx,
+ filename,
+ O_WRONLY|O_CREAT,
+ S_IREAD|S_IWRITE);
#endif
- if (-1 == bf->fd) {
- FREE(bf);
- return NULL;
+ if (-1 == bf->fd) {
+ FREE(bf);
+ return NULL;
+ }
+ bf->filename = STRDUP(filename);
+ } else {
+ bf->fd = -1;
+ bf->filename = NULL;
}
-
/* Alloc block */
bf->lock = MUTEX_CREATE(YES);
bf->bitArray = MALLOC_LARGE(size);
@@ -450,31 +455,32 @@
0,
bf->bitArraySize);
- /* Read from the file what bits we can */
- rbuff = MALLOC(BUFFSIZE);
- pos = 0;
- while (pos < size*8) {
- int res;
-
- res = READ(bf->fd,
- rbuff,
- BUFFSIZE);
- if (res == 0)
- break; /* is ok! we just did not use that many bits yet */
- for (i=0;i<res;i++) {
- if ( (rbuff[i] & 0x0F) != 0)
- setBit(bf->bitArray,
- pos + i*2);
- if ( (rbuff[i] & 0xF0) != 0)
- setBit(bf->bitArray,
- pos + i*2 + 1);
+ if (bf->fd != -1) {
+ /* Read from the file what bits we can */
+ rbuff = MALLOC(BUFFSIZE);
+ pos = 0;
+ while (pos < size*8) {
+ int res;
+
+ res = READ(bf->fd,
+ rbuff,
+ BUFFSIZE);
+ if (res == 0)
+ break; /* is ok! we just did not use that many bits yet */
+ for (i=0;i<res;i++) {
+ if ( (rbuff[i] & 0x0F) != 0)
+ setBit(bf->bitArray,
+ pos + i*2);
+ if ( (rbuff[i] & 0xF0) != 0)
+ setBit(bf->bitArray,
+ pos + i*2 + 1);
+ }
+ if (res < BUFFSIZE)
+ break;
+ pos += BUFFSIZE * 2; /* 2 bits per byte in the buffer */
}
- if (res < BUFFSIZE)
- break;
- pos += BUFFSIZE * 2; /* 2 bits per byte in the buffer */
+ FREE(rbuff);
}
- FREE(rbuff);
- bf->filename = STRDUP(filename);
return bf;
}
@@ -489,9 +495,10 @@
if (NULL == bf)
return;
MUTEX_DESTROY(bf->lock);
- disk_file_close(bf->ectx,
- bf->filename,
- bf->fd);
+ if (bf->fd != -1)
+ disk_file_close(bf->ectx,
+ bf->filename,
+ bf->fd);
FREENONNULL(bf->filename);
FREE(bf->bitArray);
FREE(bf);
@@ -510,8 +517,9 @@
memset(bf->bitArray,
0,
bf->bitArraySize);
- makeEmptyFile(bf->fd,
- bf->bitArraySize * 4);
+ if (bf->fd != -1)
+ makeEmptyFile(bf->fd,
+ bf->bitArraySize * 4);
MUTEX_UNLOCK(bf->lock);
}
@@ -607,8 +615,9 @@
memset(bf->bitArray,
0,
bf->bitArraySize);
- makeEmptyFile(bf->fd,
- bf->bitArraySize * 4);
+ if (bf->fd != -1)
+ makeEmptyFile(bf->fd,
+ bf->bitArraySize * 4);
e = iterator(iterator_arg);
while (e != NULL) {
addToBloomfilter(bf,
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2007-06-30 04:56:01 UTC (rev 5187)
+++ GNUnet/todo 2007-06-30 11:37:04 UTC (rev 5188)
@@ -3,18 +3,15 @@
Annotations:
RC == Release Critical
+0.7.2a [7'07] (aka "bugfixes"):
+- fix memory/socket leak in gnunetd
+
+
0.7.3 [8'07] (aka "features"):
- chat support basics [RC]
-- insert meta-data under hash (md5? sha1? sha-512? GNUnet-URI?)
- as keyword (to allow getting meta-data from URI only) [RC]
- old/new features:
* HTTP transport (libcurl, libmicrohttpd) [#765]
* SMTP transport (libesmtp)
- * SMTP logger
- * support NAT-PMP (in addition to UPnP)
- * add bloomfilter to dstore
- * asynchronous (or client-side?) DNS resolution (for peer-info stuff)
- => use GNU adns library?
- Documentation:
* LJ article
- Testcases:
@@ -29,14 +26,21 @@
See also: https://gnunet.org/drupal/?q=node/97 [RC]
- guard friendly connection count (#1018) [RC]
- power insert [#854]
-- have a way to clean up namespace information
1.0.0 (aka "userfriendly"):
- implement testbed for profiling
+Small extensions (that could be done any time):
+- insert meta-data under hash (md5? sha1? sha-512? GNUnet-URI?)
+ as keyword (to allow getting meta-data from URI only) [RC]
+- support NAT-PMP (in addition to UPnP)
+- SMTP logger
+- mysql implementation of dstore
+
+
FreeServices
- onion routing
- application service
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5188 - in GNUnet: . src/applications/datastore src/applications/dstore src/applications/sqstore_sqlite src/include src/server src/util/containers,
gnunet <=