[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3301 - in GNUnet/src: applications/identity applications/t
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3301 - in GNUnet/src: applications/identity applications/transport include transports util/config util/config_impl util/disk util/threads |
Date: |
Thu, 24 Aug 2006 18:52:05 -0700 (PDT) |
Author: grothoff
Date: 2006-08-24 18:51:59 -0700 (Thu, 24 Aug 2006)
New Revision: 3301
Modified:
GNUnet/src/applications/identity/hostkey.c
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/include/gnunet_util_string.h
GNUnet/src/transports/udp.c
GNUnet/src/util/config/config.c
GNUnet/src/util/config_impl/impl.c
GNUnet/src/util/disk/storage.c
GNUnet/src/util/threads/pthread.c
Log:
various bugfixes
Modified: GNUnet/src/applications/identity/hostkey.c
===================================================================
--- GNUnet/src/applications/identity/hostkey.c 2006-08-25 01:22:00 UTC (rev
3300)
+++ GNUnet/src/applications/identity/hostkey.c 2006-08-25 01:51:59 UTC (rev
3301)
@@ -95,14 +95,11 @@
int res;
GE_ASSERT(ectx,
- -1 != GC_get_configuration_value_string(cfg,
- "GNUNETD",
- "GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY,
- &hostkeyfile));
- gnHome = string_expandFileName(ectx,
- hostkeyfile);
- FREE(hostkeyfile);
+ -1 != GC_get_configuration_value_filename(cfg,
+ "GNUNETD",
+ "GNUNETD_HOME",
+ VAR_DAEMON_DIRECTORY,
+ &gnHome));
disk_directory_create(ectx,
gnHome);
if (YES != disk_directory_test(ectx,
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2006-08-25 01:22:00 UTC (rev
3300)
+++ GNUnet/src/applications/identity/identity.c 2006-08-25 01:51:59 UTC (rev
3301)
@@ -1109,14 +1109,11 @@
gnHome = NULL;
GE_ASSERT(ectx,
- -1 != GC_get_configuration_value_string(coreAPI->cfg,
- "GNUNETD",
- "GNUNETD_HOME",
- VAR_DAEMON_DIRECTORY,
- &tmp));
- gnHome = string_expandFileName(ectx,
- tmp);
- FREE(tmp);
+ -1 != GC_get_configuration_value_filename(coreAPI->cfg,
+ "GNUNETD",
+ "GNUNETD_HOME",
+ VAR_DAEMON_DIRECTORY,
+ &gnHome));
if (gnHome == NULL)
return NULL;
tmp = MALLOC(strlen(gnHome) + strlen(HOST_DIR) + 2);
@@ -1125,11 +1122,11 @@
strcat(tmp, HOST_DIR);
networkIdDirectory = NULL;
GE_ASSERT(ectx,
- -1 != GC_get_configuration_value_string(coreAPI->cfg,
- "GNUNETD",
- "HOSTS",
- tmp,
- &networkIdDirectory));
+ -1 != GC_get_configuration_value_filename(coreAPI->cfg,
+ "GNUNETD",
+ "HOSTS",
+ tmp,
+ &networkIdDirectory));
FREE(tmp);
disk_directory_create(ectx,
networkIdDirectory);
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2006-08-25 01:22:00 UTC
(rev 3300)
+++ GNUnet/src/applications/transport/transport.c 2006-08-25 01:51:59 UTC
(rev 3301)
@@ -446,7 +446,6 @@
return used;
}
-
/**
* Actually start the transport services and begin
* receiving messages.
@@ -456,8 +455,10 @@
ctapi.receive = mpp;
for (i=0;i<tapis_count;i++)
- if (tapis[i] != NULL)
- tapis[i]->startTransportServer();
+ if (tapis[i] != NULL) {
+ if (OK != tapis[i]->startTransportServer())
+ unloadTransport(i);
+ }
}
/**
@@ -511,7 +512,27 @@
tapi);
}
+static void unloadTransport(int i) {
+ void (*ptr)();
+ doneHelper(&tapis[i], NULL);
+ cron_del_job(coreAPI->cron,
+ &createSignedhello,
+ HELLO_RECREATE_FREQ,
+ tapis[i]);
+ ptr = os_plugin_resolve_function(tapis[i]->libHandle,
+ "donetransport_",
+ NO);
+ if (ptr != NULL)
+ ptr();
+ FREE(tapis[i]->transName);
+ FREENONNULL(tapis[i]->helo);
+ tapis[i]->helo = NULL;
+ os_plugin_unload(tapis[i]->libHandle);
+ tapis[i] = NULL;
+}
+
+
/**
* Initialize the transport layer.
*/
@@ -659,27 +680,11 @@
*/
int release_module_transport() {
int i;
- void (*ptr)();
forEachTransport(&doneHelper, NULL);
- for (i=0;i<tapis_count;i++) {
- if (tapis[i] != NULL) {
- cron_del_job(coreAPI->cron,
- &createSignedhello,
- HELLO_RECREATE_FREQ,
- tapis[i]);
- ptr = os_plugin_resolve_function(tapis[i]->libHandle,
- "donetransport_",
- NO);
- if (ptr != NULL)
- ptr();
- FREE(tapis[i]->transName);
- FREENONNULL(tapis[i]->helo);
- tapis[i]->helo = NULL;
- os_plugin_unload(tapis[i]->libHandle);
- }
- }
-
+ for (i=0;i<tapis_count;i++)
+ if (tapis[i] != NULL)
+ unloadTransport(i);
MUTEX_DESTROY(tapis_lock);
tapis_lock = NULL;
GROW(tapis,
Modified: GNUnet/src/include/gnunet_util_string.h
===================================================================
--- GNUnet/src/include/gnunet_util_string.h 2006-08-25 01:22:00 UTC (rev
3300)
+++ GNUnet/src/include/gnunet_util_string.h 2006-08-25 01:51:59 UTC (rev
3301)
@@ -156,7 +156,7 @@
* Append an element to a list (growing the
* list by one).
*/
-#define APPEND(arr,size,element) GROW(arr,size,size+1); arr[size-1] = (element)
+#define APPEND(arr,size,element) GROW(arr,size,(size)+1); arr[(size)-1] =
(element)
/**
* Like snprintf, just aborts if the buffer is of insufficient size.
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2006-08-25 01:22:00 UTC (rev 3300)
+++ GNUnet/src/transports/udp.c 2006-08-25 01:51:59 UTC (rev 3301)
@@ -359,6 +359,7 @@
udp_sock = socket_create(ectx,
load_monitor,
sock);
+ GE_ASSERT(ectx, udp_sock != NULL);
return OK;
}
Modified: GNUnet/src/util/config/config.c
===================================================================
--- GNUnet/src/util/config/config.c 2006-08-25 01:22:00 UTC (rev 3300)
+++ GNUnet/src/util/config/config.c 2006-08-25 01:51:59 UTC (rev 3301)
@@ -161,7 +161,7 @@
const char * option,
const char * def,
char ** value) {
- return cfg->get_configuration_value_string(cfg, section, option, def, value);
+ return cfg->get_configuration_value_filename(cfg, section, option, def,
value);
}
/**
Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c 2006-08-25 01:22:00 UTC (rev 3300)
+++ GNUnet/src/util/config_impl/impl.c 2006-08-25 01:51:59 UTC (rev 3301)
@@ -456,6 +456,7 @@
if (e != NULL) {
val = (e->dirty_val != NULL) ? e->dirty_val : e->val;
*value = STRDUP(val);
+ ret = 0;
} else {
if (def == NULL) {
MUTEX_UNLOCK(cfg->data->lock);
@@ -628,9 +629,14 @@
data = cfg->data;
GE_ASSERT(data->ectx, def != NULL);
+ tmp = NULL;
ret = _get_configuration_value_string(cfg, section, option, def, &tmp);
- *value = string_expandFileName(data->ectx, tmp);
- FREE(tmp);
+ if (tmp != NULL) {
+ *value = string_expandFileName(data->ectx, tmp);
+ FREE(tmp);
+ } else {
+ *value = NULL;
+ }
return ret;
}
Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c 2006-08-25 01:22:00 UTC (rev 3300)
+++ GNUnet/src/util/disk/storage.c 2006-08-25 01:51:59 UTC (rev 3301)
@@ -591,7 +591,7 @@
const char * filename,
int oflag,
...) {
- const char * fn;
+ char * fn;
int mode;
int ret;
#ifdef MINGW
@@ -608,9 +608,9 @@
filename);
return -1;
}
- fn = szFile;
+ fn = STRDUP(szFile);
#else
- fn = filename;
+ fn = string_expandFileName(ectx, filename);
#endif
if (oflag & O_CREAT) {
va_list arg;
@@ -629,7 +629,8 @@
GE_LOG_STRERROR_FILE(ectx,
GE_WARNING | GE_USER | GE_BULK,
"open",
- filename);
+ fn);
+ FREE(fn);
return ret;
}
Modified: GNUnet/src/util/threads/pthread.c
===================================================================
--- GNUnet/src/util/threads/pthread.c 2006-08-25 01:22:00 UTC (rev 3300)
+++ GNUnet/src/util/threads/pthread.c 2006-08-25 01:51:59 UTC (rev 3301)
@@ -50,7 +50,8 @@
* Returns YES if pt is the handle for THIS thread.
*/
int PTHREAD_TEST_SELF(PThread * handle) {
- GE_ASSERT(NULL, handle != NULL);
+ if (handle == NULL)
+ return NO;
#if HAVE_PTHREAD_EQUAL
if (pthread_equal(pthread_self(), handle->pt))
#else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3301 - in GNUnet/src: applications/identity applications/transport include transports util/config util/config_impl util/disk util/threads,
grothoff <=