projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- implementation for mantis 0002485
[oweals/gnunet.git]
/
src
/
transport
/
test_transport_testing.c
diff --git
a/src/transport/test_transport_testing.c
b/src/transport/test_transport_testing.c
index 996ea054357cc62a1783156ca06a5cf2a4542ce2..7875f1cfa191709382eb386b6529ba37e63eaa10 100644
(file)
--- a/
src/transport/test_transport_testing.c
+++ b/
src/transport/test_transport_testing.c
@@
-27,22
+27,8
@@
* C code apparently.
*/
#include "platform.h"
* C code apparently.
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_scheduler_lib.h"
#include "gnunet_transport_service.h"
#include "gnunet_transport_service.h"
-#include "transport.h"
#include "transport-testing.h"
#include "transport-testing.h"
-
-#define VERBOSE GNUNET_EXTRA_LOGGING
-
-#define VERBOSE_ARM GNUNET_EXTRA_LOGGING
-
-#define START_ARM GNUNET_YES
-
/**
* How long until we give up on transmitting the message?
*/
/**
* How long until we give up on transmitting the message?
*/
@@
-81,6
+67,12
@@
end_badly ()
timeout_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
timeout_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
+ if (NULL != cc)
+ {
+ GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc);
+ cc = NULL;
+ }
+
if (p1 != NULL)
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
if (p2 != NULL)
if (p1 != NULL)
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
if (p2 != NULL)
@@
-94,7
+86,7
@@
end_badly ()
static void
testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
{
static void
testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
{
- char *ps = strdup (GNUNET_i2s (&p1->id));
+ char *ps =
GNUNET_
strdup (GNUNET_i2s (&p1->id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s') connected to peer %u (`%s')!\n", p1->no, ps,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer %u (`%4s') connected to peer %u (`%s')!\n", p1->no, ps,
@@
-140,11
+132,12
@@
start_cb (struct PeerContext *p, void *cls)
if (started != 2)
return;
if (started != 2)
return;
- char *sender_c = strdup (GNUNET_i2s (&p1->id));
+ char *sender_c =
GNUNET_
strdup (GNUNET_i2s (&p1->id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
+ GNUNET_free (sender_c);
cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb,
NULL);
cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb,
NULL);
@@
-165,6
+158,7
@@
run (void *cls, char *const *args, const char *cfgfile,
"test_transport_api_tcp_peer1.conf",
1, ¬ify_receive, ¬ify_connect,
¬ify_disconnect, &start_cb, p1);
"test_transport_api_tcp_peer1.conf",
1, ¬ify_receive, ¬ify_connect,
¬ify_disconnect, &start_cb, p1);
+
p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
"test_transport_api_tcp_peer2.conf",
2, ¬ify_receive, ¬ify_connect,
p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
"test_transport_api_tcp_peer2.conf",
2, ¬ify_receive, ¬ify_connect,
@@
-192,19
+186,12
@@
int
main (int argc, char *argv[])
{
GNUNET_log_setup ("test_transport_testing",
main (int argc, char *argv[])
{
GNUNET_log_setup ("test_transport_testing",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
"WARNING",
-#endif
NULL);
char *const argv_1[] = { "test_transport_testing",
"-c",
"test_transport_api_data.conf",
NULL);
char *const argv_1[] = { "test_transport_testing",
"-c",
"test_transport_api_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
NULL
};