diff options
Diffstat (limited to 'src/util/test_server_mst_interrupt.c')
-rw-r--r-- | src/util/test_server_mst_interrupt.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/src/util/test_server_mst_interrupt.c b/src/util/test_server_mst_interrupt.c index fd34bd00a..8fd7a2b54 100644 --- a/src/util/test_server_mst_interrupt.c +++ b/src/util/test_server_mst_interrupt.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "gnunet_time_lib.h" | 30 | #include "gnunet_time_lib.h" |
31 | 31 | ||
32 | static struct GNUNET_SERVER_MessageStreamTokenizer * mst; | 32 | static struct GNUNET_SERVER_MessageStreamTokenizer * mst; |
33 | static int ret; | 33 | |
34 | 34 | ||
35 | /* Callback destroying mst with data in buffer */ | 35 | /* Callback destroying mst with data in buffer */ |
36 | static int | 36 | static int |
@@ -42,40 +42,23 @@ mst_cb (void *cls, void *client, | |||
42 | return GNUNET_SYSERR; | 42 | return GNUNET_SYSERR; |
43 | } | 43 | } |
44 | 44 | ||
45 | /** | ||
46 | * Main method | ||
47 | */ | ||
48 | static int | ||
49 | check () | ||
50 | { | ||
51 | 45 | ||
46 | int | ||
47 | main (int argc, char *argv[]) | ||
48 | { | ||
52 | struct GNUNET_PeerIdentity id; | 49 | struct GNUNET_PeerIdentity id; |
53 | struct GNUNET_MessageHeader msg[2]; | 50 | struct GNUNET_MessageHeader msg[2]; |
54 | 51 | ||
55 | /* Prepare */ | 52 | GNUNET_log_setup ("test_server_mst_interrupt", "WARNING", NULL); |
56 | memset (&id, sizeof (id), '\0'); | 53 | memset (&id, 0, sizeof (id)); |
57 | msg[0].size = htons (sizeof (msg)); | 54 | msg[0].size = htons (sizeof (msg)); |
58 | msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); | 55 | msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); |
59 | |||
60 | mst = GNUNET_SERVER_mst_create(mst_cb, NULL); | 56 | mst = GNUNET_SERVER_mst_create(mst_cb, NULL); |
61 | 57 | GNUNET_SERVER_mst_receive (mst, &id, | |
62 | GNUNET_SERVER_mst_receive(mst, &id, (const char *) &msg, 2 * sizeof (msg), GNUNET_NO, GNUNET_NO); | 58 | (const char *) &msg, 2 * sizeof (msg), |
63 | 59 | GNUNET_NO, GNUNET_NO); | |
64 | /* If we reach this line, it did not crash */ | 60 | /* If we reach this line, it did not crash */ |
65 | ret = 0; | 61 | return 0; |
66 | |||
67 | return ret; | ||
68 | } | ||
69 | |||
70 | int | ||
71 | main (int argc, char *argv[]) | ||
72 | { | ||
73 | ret = 1; | ||
74 | |||
75 | GNUNET_log_setup ("test_server", "WARNING", NULL); | ||
76 | check (); | ||
77 | |||
78 | return ret; | ||
79 | } | 62 | } |
80 | 63 | ||
81 | /* end of test_server_mst_interrupt.c */ | 64 | /* end of test_server_mst_interrupt.c */ |