[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21306 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21306 - gnunet/src/transport |
Date: |
Sun, 6 May 2012 20:53:13 +0200 |
Author: grothoff
Date: 2012-05-06 20:53:13 +0200 (Sun, 06 May 2012)
New Revision: 21306
Modified:
gnunet/src/transport/transport-testing.c
Log:
-fixing #2309
Modified: gnunet/src/transport/transport-testing.c
===================================================================
--- gnunet/src/transport/transport-testing.c 2012-05-06 18:41:36 UTC (rev
21305)
+++ gnunet/src/transport/transport-testing.c 2012-05-06 18:53:13 UTC (rev
21306)
@@ -52,6 +52,7 @@
return NULL;
}
+
static struct PeerContext *
find_peer_context (struct GNUNET_TRANSPORT_TESTING_handle *tth,
const struct GNUNET_PeerIdentity *peer)
@@ -69,7 +70,8 @@
return t;
}
-struct ConnectingContext *
+
+static struct ConnectingContext *
find_connecting_context (struct GNUNET_TRANSPORT_TESTING_handle *tth,
struct PeerContext *p1, struct PeerContext *p2)
{
@@ -88,6 +90,7 @@
return cc;
}
+
static void
notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
@@ -134,6 +137,7 @@
}
}
+
static void
notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
{
@@ -167,6 +171,7 @@
p->nd (p->cb_cls, peer);
}
+
static void
notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
@@ -180,6 +185,7 @@
p->rec (p->cb_cls, peer, message, ats, ats_count);
}
+
static void
get_hello (void *cb_cls, const struct GNUNET_MessageHeader *message)
{
@@ -307,11 +313,7 @@
GNUNET_OS_start_process (GNUNET_YES,
NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm", "-c", cfgname,
-#if VERBOSE_PEERS
- "-L", "DEBUG",
-#else
"-L", "ERROR",
-#endif
NULL);
p->no = peer_id;
@@ -361,10 +363,8 @@
GNUNET_assert (p->servicehome != NULL);
/* shutdown */
-#if VERBOSE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
"Stopping peer %u (`%s')\n", p->no, GNUNET_i2s (&p->id));
-#endif
if (p->ghh != NULL)
GNUNET_TRANSPORT_get_hello_cancel (p->ghh);
p->ghh = NULL;
@@ -390,11 +390,8 @@
/* start */
-#if VERBOSE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing",
"Restarting peer %u (`%s')\n", p->no, GNUNET_i2s (&p->id));
-#endif
-
sleep (5); // YUCK!
if (GNUNET_DISK_file_test (cfgname) == GNUNET_NO)
@@ -424,11 +421,7 @@
GNUNET_OS_start_process (GNUNET_YES,
NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm", "-c", cfgname,
-#if VERBOSE_PEERS
- "-L", "DEBUG",
-#else
"-L", "ERROR",
-#endif
NULL);
p->th =
@@ -451,6 +444,7 @@
return GNUNET_SYSERR;
}
+
/**
* shutdown the given peer
* @param tth testing handle
@@ -508,6 +502,7 @@
p = NULL;
}
+
/**
* Connect the given peers and call the callback when both peers report the
* inbound connection. Remarks: start_peer's notify_connect callback can be
called
@@ -559,6 +554,7 @@
return cc;
}
+
/**
* Cancel the request to connect two peers
* Tou MUST cancel the request if you stop the peers before the peers
connected succesfully
@@ -627,6 +623,7 @@
tth = NULL;
}
+
/**
* Initialize the transport testing
* @return transport testing handle
@@ -722,6 +719,7 @@
return res;
}
+
/**
* Extracts the test filename from an absolute file name and removes the
extension
* @param file absolute file name
@@ -781,7 +779,8 @@
/**
- * Extracts the plugin anme from an absolute file name and the test name
+ * Extracts the plugin name from an absolute file name and the test name
+ *
* @param file absolute file name
* @param test test name
* @param dest where to store result
@@ -790,43 +789,39 @@
GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *file,
const char *test, char **dest)
{
+ char *filename;
+ char *dotexe;
char *e = extract_filename (file);
char *t = extract_filename (test);
- char *filename = NULL;
- char *dotexe;
-
- if (e == NULL)
+ if (NULL == e)
goto fail;
-
/* remove "lt-" */
filename = strstr (e, "tes");
- if (filename == NULL)
+ if (NULL == filename)
goto fail;
-
/* remove ".exe" */
if (NULL != (dotexe = strstr (filename, ".exe")))
dotexe[0] = '\0';
/* find last _ */
filename = strstr (filename, t);
- if (filename == NULL)
+ if (NULL == filename)
goto fail;
-
/* copy plugin */
filename += strlen (t);
- filename++;
+ if ('\0' != *filename)
+ filename++;
GNUNET_asprintf (dest, "%s", filename);
goto suc;
-
fail:
(*dest) = NULL;
suc:
GNUNET_free (t);
GNUNET_free (e);
-
}
+
/**
* This function takes the filename (e.g. argv[0), removes a "lt-"-prefix and
* if existing ".exe"-prefix and adds the peer-number
@@ -843,30 +838,23 @@
char *backup = filename;
char *dotexe;
- if (filename == NULL)
+ if (NULL == filename)
goto fail;
-
/* remove "lt-" */
filename = strstr (filename, "tes");
- if (filename == NULL)
+ if (NULL == filename)
goto fail;
-
/* remove ".exe" */
if (NULL != (dotexe = strstr (filename, ".exe")))
dotexe[0] = '\0';
-
- goto suc;
-
+ GNUNET_asprintf (dest, "%s_peer%u.conf", filename, count);
+ GNUNET_free (backup);
+ return;
fail:
(*dest) = NULL;
- return;
-
-suc:
- /* create cfg filename */
- GNUNET_asprintf (dest, "%s_peer%u.conf", filename, count);
GNUNET_free (backup);
}
-/* end of transport_testing.h */
+/* end of transport-testing.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21306 - gnunet/src/transport,
gnunet <=