[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18358 - in gnunet: contrib src/fs src/hostlist src/transpo
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18358 - in gnunet: contrib src/fs src/hostlist src/transport |
Date: |
Mon, 28 Nov 2011 17:45:17 +0100 |
Author: grothoff
Date: 2011-11-28 17:45:16 +0100 (Mon, 28 Nov 2011)
New Revision: 18358
Modified:
gnunet/contrib/gnunet.doxy
gnunet/src/fs/gnunet-service-fs_lc.c
gnunet/src/hostlist/gnunet-daemon-hostlist.c
gnunet/src/transport/transport-testing.c
Log:
-fixing use of uninitialized variable, some code cleanup, fixing memory leak on
error path
Modified: gnunet/contrib/gnunet.doxy
===================================================================
--- gnunet/contrib/gnunet.doxy 2011-11-28 16:25:09 UTC (rev 18357)
+++ gnunet/contrib/gnunet.doxy 2011-11-28 16:45:16 UTC (rev 18358)
@@ -253,12 +253,12 @@
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
+MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
-PREDEFINED =
+PREDEFINED = GNUNET_UNUSED="" GNUNET_PACKED=""
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
Modified: gnunet/src/fs/gnunet-service-fs_lc.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_lc.c 2011-11-28 16:25:09 UTC (rev
18357)
+++ gnunet/src/fs/gnunet-service-fs_lc.c 2011-11-28 16:45:16 UTC (rev
18358)
@@ -286,7 +286,7 @@
*
* @param client identification of the client
* @param message the actual message
- * @param ptptr where to store the pending request handle for the request
+ * @param prptr where to store the pending request handle for the request
* @return GNUNET_YES to start local processing,
* GNUNET_NO to not (yet) start local processing,
* GNUNET_SYSERR on error
Modified: gnunet/src/hostlist/gnunet-daemon-hostlist.c
===================================================================
--- gnunet/src/hostlist/gnunet-daemon-hostlist.c 2011-11-28 16:25:09 UTC
(rev 18357)
+++ gnunet/src/hostlist/gnunet-daemon-hostlist.c 2011-11-28 16:45:16 UTC
(rev 18358)
@@ -137,7 +137,12 @@
/**
* Core handler for p2p hostlist advertisements
*
+ * @param cls closure
+ * @param peer identity of the sender
+ * @param message advertisement message we got
+ * @param atsi performance information
* @param atsi_count number of records in 'atsi'
+ * @return GNUNET_OK on success
*/
static int
advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
Modified: gnunet/src/transport/transport-testing.c
===================================================================
--- gnunet/src/transport/transport-testing.c 2011-11-28 16:25:09 UTC (rev
18357)
+++ gnunet/src/transport/transport-testing.c 2011-11-28 16:45:16 UTC (rev
18358)
@@ -362,7 +362,6 @@
void *cb_cls)
{
struct GNUNET_DISK_FileHandle *fn;
- int success = GNUNET_OK;
GNUNET_assert (tth != NULL);
GNUNET_assert (p != NULL);
@@ -406,35 +405,30 @@
GNUNET_i2s (&p->id));
#endif
- sleep (5);
+ sleep (5); // YUCK!
if (GNUNET_DISK_file_test (cfgname) == GNUNET_NO)
{
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "transport-testing",
- "File not found: `%s' \n", cfgname);
- success = GNUNET_SYSERR;
- goto fail;
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "transport-testing",
+ "File not found: `%s' \n", cfgname);
+ goto fail;
}
p->cfg = GNUNET_CONFIGURATION_create ();
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- if (GNUNET_CONFIGURATION_have_value (p->cfg, "PATHS", "SERVICEHOME"))
+ if (! GNUNET_CONFIGURATION_have_value (p->cfg, "PATHS", "SERVICEHOME"))
+ goto fail;
+
fn = GNUNET_DISK_file_open (p->hostkeyfile,
- GNUNET_DISK_OPEN_READWRITE |
- GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE);
+ GNUNET_DISK_OPEN_READWRITE |
+ GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ |
+ GNUNET_DISK_PERM_USER_WRITE);
if (fn == NULL)
- {
- success = GNUNET_SYSERR;
goto fail;
- }
if (GNUNET_OK != GNUNET_DISK_file_close (fn))
- {
- success = GNUNET_SYSERR;
goto fail;
- }
p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm", "-c", cfgname,
@@ -455,16 +449,14 @@
p->ghh = GNUNET_TRANSPORT_get_hello (p->th, &get_hello, p);
GNUNET_assert (p->ghh != NULL);
+ return GNUNET_OK;
- fail:
- if (success == GNUNET_SYSERR)
- {
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
- "Restarting peer %u (`%s') failed, removing peer\n", p->no,
- GNUNET_i2s (&p->id));
- GNUNET_TRANSPORT_TESTING_stop_peer (tth,p);
- }
- return success;
+ fail:
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
+ "Restarting peer %u (`%s') failed, removing peer\n", p->no,
+ GNUNET_i2s (&p->id));
+ GNUNET_TRANSPORT_TESTING_stop_peer (tth,p);
+ return GNUNET_SYSERR;
}
/**
@@ -642,16 +634,16 @@
struct GNUNET_TRANSPORT_TESTING_handle *
GNUNET_TRANSPORT_TESTING_init ()
{
- struct GNUNET_TRANSPORT_TESTING_handle *tth =
- GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_TESTING_handle));
+ struct GNUNET_TRANSPORT_TESTING_handle *tth;
struct GNUNET_DISK_FileHandle *fd;
uint64_t fs;
uint64_t total_hostkeys;
/* prepare hostkeys */
+ tth = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_TESTING_handle));
tth->hostkey_data = NULL;
- char * hostkeys_file = "../../contrib/testing_hostkeys.dat";
+ const char * hostkeys_file = "../../contrib/testing_hostkeys.dat";
if (GNUNET_YES != GNUNET_DISK_file_test (hostkeys_file))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -666,6 +658,7 @@
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open",
hostkeys_file);
+ GNUNET_free (tth);
return NULL;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18358 - in gnunet: contrib src/fs src/hostlist src/transport,
gnunet <=