aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_testing_connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/test_testing_connect.c')
-rw-r--r--src/testing/test_testing_connect.c73
1 files changed, 28 insertions, 45 deletions
diff --git a/src/testing/test_testing_connect.c b/src/testing/test_testing_connect.c
index c243cb1d7..ca08eaad3 100644
--- a/src/testing/test_testing_connect.c
+++ b/src/testing/test_testing_connect.c
@@ -45,71 +45,62 @@ static struct GNUNET_CONFIGURATION_Handle *c2;
45 45
46static struct GNUNET_SCHEDULER_Handle *sched; 46static struct GNUNET_SCHEDULER_Handle *sched;
47 47
48static void end2_cb(void *cls, 48static void
49 const char *emsg) 49end2_cb (void *cls, const char *emsg)
50{ 50{
51 GNUNET_assert (emsg == NULL); 51 GNUNET_assert (emsg == NULL);
52#if VERBOSE 52#if VERBOSE
53 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 53 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
54 "Both daemons terminated, will now exit.\n"); 54 "Both daemons terminated, will now exit.\n");
55#endif 55#endif
56 ok = 0; 56 ok = 0;
57} 57}
58 58
59static void end1_cb(void *cls, 59static void
60 const char *emsg) 60end1_cb (void *cls, const char *emsg)
61{ 61{
62 GNUNET_assert (emsg == NULL); 62 GNUNET_assert (emsg == NULL);
63 GNUNET_TESTING_daemon_stop (d2, &end2_cb, NULL); 63 GNUNET_TESTING_daemon_stop (d2, &end2_cb, NULL);
64 d2 = NULL; 64 d2 = NULL;
65} 65}
66 66
67 67
68static void 68static void
69my_connect_complete (void *cls, 69my_connect_complete (void *cls, const char *emsg)
70 const char *emsg)
71{ 70{
72 GNUNET_TESTING_daemon_stop (d1, &end1_cb, NULL); 71 GNUNET_TESTING_daemon_stop (d1, &end1_cb, NULL);
73 d1 = NULL; 72 d1 = NULL;
74} 73}
75 74
76 75
77static void my_cb2(void *cls, 76static void
78 const struct GNUNET_PeerIdentity *id, 77my_cb2 (void *cls,
79 const struct GNUNET_CONFIGURATION_Handle *cfg, 78 const struct GNUNET_PeerIdentity *id,
80 struct GNUNET_TESTING_Daemon *d, 79 const struct GNUNET_CONFIGURATION_Handle *cfg,
81 const char *emsg) 80 struct GNUNET_TESTING_Daemon *d, const char *emsg)
82{ 81{
83 GNUNET_assert (id != NULL); 82 GNUNET_assert (id != NULL);
84#if VERBOSE 83#if VERBOSE
85 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 84 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
86 "Daemon `%s' started.\n", 85 "Daemon `%s' started.\n", GNUNET_i2s (id));
87 GNUNET_i2s (id));
88#endif 86#endif
89 GNUNET_TESTING_daemons_connect (d1, d2, 87 GNUNET_TESTING_daemons_connect (d1, d2,
90 TIMEOUT, 88 TIMEOUT, &my_connect_complete, NULL);
91 &my_connect_complete,
92 NULL);
93} 89}
94 90
95 91
96static void my_cb1(void *cls, 92static void
97 const struct GNUNET_PeerIdentity *id, 93my_cb1 (void *cls,
98 const struct GNUNET_CONFIGURATION_Handle *cfg, 94 const struct GNUNET_PeerIdentity *id,
99 struct GNUNET_TESTING_Daemon *d, 95 const struct GNUNET_CONFIGURATION_Handle *cfg,
100 const char *emsg) 96 struct GNUNET_TESTING_Daemon *d, const char *emsg)
101{ 97{
102 GNUNET_assert (id != NULL); 98 GNUNET_assert (id != NULL);
103#if VERBOSE 99#if VERBOSE
104 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
105 "Daemon `%s' started.\n", 101 "Daemon `%s' started.\n", GNUNET_i2s (id));
106 GNUNET_i2s (id));
107#endif 102#endif
108 d2 = GNUNET_TESTING_daemon_start (sched, 103 d2 = GNUNET_TESTING_daemon_start (sched, c2, NULL, &my_cb2, NULL);
109 c2,
110 NULL,
111 &my_cb2,
112 NULL);
113 GNUNET_assert (d2 != NULL); 104 GNUNET_assert (d2 != NULL);
114 105
115} 106}
@@ -119,26 +110,18 @@ static void
119run (void *cls, 110run (void *cls,
120 struct GNUNET_SCHEDULER_Handle *s, 111 struct GNUNET_SCHEDULER_Handle *s,
121 char *const *args, 112 char *const *args,
122 const char *cfgfile, 113 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
123 const struct GNUNET_CONFIGURATION_Handle *cfg)
124{ 114{
125 sched = s; 115 sched = s;
126 ok = 1; 116 ok = 1;
127#if VERBOSE 117#if VERBOSE
128 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemon.\n");
129 "Starting daemon.\n");
130#endif 119#endif
131 c1 = GNUNET_CONFIGURATION_create (); 120 c1 = GNUNET_CONFIGURATION_create ();
132 GNUNET_CONFIGURATION_parse (c1, 121 GNUNET_CONFIGURATION_parse (c1, "test_testing_connect_peer1.conf");
133 "test_testing_connect_peer1.conf");
134 c2 = GNUNET_CONFIGURATION_create (); 122 c2 = GNUNET_CONFIGURATION_create ();
135 GNUNET_CONFIGURATION_parse (c2, 123 GNUNET_CONFIGURATION_parse (c2, "test_testing_connect_peer2.conf");
136 "test_testing_connect_peer2.conf"); 124 d1 = GNUNET_TESTING_daemon_start (sched, c1, NULL, &my_cb1, NULL);
137 d1 = GNUNET_TESTING_daemon_start (sched,
138 c1,
139 NULL,
140 &my_cb1,
141 NULL);
142 GNUNET_assert (d1 != NULL); 125 GNUNET_assert (d1 != NULL);
143} 126}
144 127