diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-07-25 21:21:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-07-25 21:21:31 +0000 |
commit | 8aa363b11a33f79667699ab563d2bdbcb193e314 (patch) | |
tree | 8228c2d7f1aac2446587ba0485014269e27a2633 /src/hostlist/test_gnunet_daemon_hostlist.c | |
parent | 85b502cf01747eff2acaaa0bdea79321c4c28614 (diff) | |
download | gnunet-8aa363b11a33f79667699ab563d2bdbcb193e314.tar.gz gnunet-8aa363b11a33f79667699ab563d2bdbcb193e314.zip |
fix compile errors
Diffstat (limited to 'src/hostlist/test_gnunet_daemon_hostlist.c')
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index 443a0d17e..fa333bb91 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c | |||
@@ -24,12 +24,23 @@ | |||
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | #include "gnunet_arm_lib.h" | 27 | #include "gnunet_arm_service.h" |
28 | #include "gnunet_transport_service.h" | ||
28 | 29 | ||
29 | #define VERBOSE GNUNET_YES | 30 | #define VERBOSE GNUNET_YES |
30 | 31 | ||
31 | #define START_ARM GNUNET_YES | 32 | #define START_ARM GNUNET_YES |
32 | 33 | ||
34 | |||
35 | /** | ||
36 | * How long until we give up on transmitting the message? | ||
37 | */ | ||
38 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) | ||
39 | |||
40 | static int ok; | ||
41 | |||
42 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
43 | |||
33 | struct PeerContext | 44 | struct PeerContext |
34 | { | 45 | { |
35 | struct GNUNET_CONFIGURATION_Handle *cfg; | 46 | struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -42,6 +53,37 @@ struct PeerContext | |||
42 | #endif | 53 | #endif |
43 | }; | 54 | }; |
44 | 55 | ||
56 | static struct PeerContext p1; | ||
57 | |||
58 | static struct PeerContext p2; | ||
59 | |||
60 | |||
61 | |||
62 | static void | ||
63 | process_hello (void *cls, | ||
64 | struct GNUNET_TIME_Relative latency, | ||
65 | const struct GNUNET_PeerIdentity *peer, | ||
66 | const struct GNUNET_MessageHeader *message) | ||
67 | { | ||
68 | struct PeerContext *p = cls; | ||
69 | |||
70 | GNUNET_assert (peer != NULL); | ||
71 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
72 | "Received (my) `%s' from transport service of `%4s'\n", | ||
73 | "HELLO", GNUNET_i2s (peer)); | ||
74 | GNUNET_assert (message != NULL); | ||
75 | p->hello = GNUNET_malloc (ntohs (message->size)); | ||
76 | memcpy (p->hello, message, ntohs (message->size)); | ||
77 | if ((p == &p1) && (p2.th != NULL)) | ||
78 | GNUNET_TRANSPORT_offer_hello (p2.th, message); | ||
79 | if ((p == &p2) && (p1.th != NULL)) | ||
80 | GNUNET_TRANSPORT_offer_hello (p1.th, message); | ||
81 | |||
82 | if ((p == &p1) && (p2.hello != NULL)) | ||
83 | GNUNET_TRANSPORT_offer_hello (p1.th, p2.hello); | ||
84 | if ((p == &p2) && (p1.hello != NULL)) | ||
85 | GNUNET_TRANSPORT_offer_hello (p2.th, p1.hello); | ||
86 | } | ||
45 | 87 | ||
46 | 88 | ||
47 | static void | 89 | static void |
@@ -72,7 +114,7 @@ run (void *cls, | |||
72 | const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg) | 114 | const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg) |
73 | { | 115 | { |
74 | GNUNET_assert (ok == 1); | 116 | GNUNET_assert (ok == 1); |
75 | OKPP; | 117 | ok++; |
76 | sched = s; | 118 | sched = s; |
77 | setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); | 119 | setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); |
78 | setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); | 120 | setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); |