diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-06-18 21:49:23 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-06-18 21:49:23 +0000 |
commit | d8d3021ad9af2abe551fd6cd0fe2529a99d3683c (patch) | |
tree | df0e7f7e1105700f40396e624f1b3f49a20c1197 /src | |
parent | 240091007e4aa56fa36edb62f526b0d390879d95 (diff) | |
download | gnunet-d8d3021ad9af2abe551fd6cd0fe2529a99d3683c.tar.gz gnunet-d8d3021ad9af2abe551fd6cd0fe2529a99d3683c.zip |
-fix
Diffstat (limited to 'src')
-rw-r--r-- | src/peerstore/perf_peerstore_store.c | 3 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_iterate.c | 37 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_sync.c | 4 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_watch.c | 3 | ||||
-rw-r--r-- | src/peerstore/test_plugin_peerstore.c | 5 |
5 files changed, 27 insertions, 25 deletions
diff --git a/src/peerstore/perf_peerstore_store.c b/src/peerstore/perf_peerstore_store.c index 68df273dc..82a3adec1 100644 --- a/src/peerstore/perf_peerstore_store.c +++ b/src/peerstore/perf_peerstore_store.c | |||
@@ -60,7 +60,7 @@ store () | |||
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | static int | 63 | static void |
64 | watch_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | 64 | watch_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, |
65 | const char *emsg) | 65 | const char *emsg) |
66 | { | 66 | { |
@@ -72,7 +72,6 @@ watch_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | |||
72 | } | 72 | } |
73 | else | 73 | else |
74 | store (); | 74 | store (); |
75 | return GNUNET_YES; | ||
76 | } | 75 | } |
77 | 76 | ||
78 | 77 | ||
diff --git a/src/peerstore/test_peerstore_api_iterate.c b/src/peerstore/test_peerstore_api_iterate.c index 797b3146e..83a6bf7b7 100644 --- a/src/peerstore/test_peerstore_api_iterate.c +++ b/src/peerstore/test_peerstore_api_iterate.c | |||
@@ -29,6 +29,7 @@ | |||
29 | static int ok = 1; | 29 | static int ok = 1; |
30 | 30 | ||
31 | static struct GNUNET_PEERSTORE_Handle *h; | 31 | static struct GNUNET_PEERSTORE_Handle *h; |
32 | static struct GNUNET_PEERSTORE_IterateContext *ic; | ||
32 | 33 | ||
33 | static char *ss = "test_peerstore_api_iterate"; | 34 | static char *ss = "test_peerstore_api_iterate"; |
34 | static struct GNUNET_PeerIdentity p1; | 35 | static struct GNUNET_PeerIdentity p1; |
@@ -40,60 +41,66 @@ static char *val = "test_peerstore_api_iterate_val"; | |||
40 | static int count = 0; | 41 | static int count = 0; |
41 | 42 | ||
42 | 43 | ||
43 | static int | 44 | static void |
44 | iter3_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | 45 | iter3_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, |
45 | const char *emsg) | 46 | const char *emsg) |
46 | { | 47 | { |
47 | if (NULL != emsg) | 48 | if (NULL != emsg) |
48 | return GNUNET_NO; | 49 | { |
50 | GNUNET_PEERSTORE_iterate_cancel (ic); | ||
51 | return; | ||
52 | } | ||
49 | if (NULL != record) | 53 | if (NULL != record) |
50 | { | 54 | { |
51 | count++; | 55 | count++; |
52 | return GNUNET_YES; | 56 | return; |
53 | } | 57 | } |
54 | GNUNET_assert (count == 3); | 58 | GNUNET_assert (count == 3); |
55 | ok = 0; | 59 | ok = 0; |
56 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); | 60 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); |
57 | GNUNET_SCHEDULER_shutdown (); | 61 | GNUNET_SCHEDULER_shutdown (); |
58 | return GNUNET_YES; | ||
59 | } | 62 | } |
60 | 63 | ||
61 | 64 | ||
62 | static int | 65 | static void |
63 | iter2_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | 66 | iter2_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, |
64 | const char *emsg) | 67 | const char *emsg) |
65 | { | 68 | { |
66 | if (NULL != emsg) | 69 | if (NULL != emsg) |
67 | return GNUNET_NO; | 70 | { |
71 | GNUNET_PEERSTORE_iterate_cancel (ic); | ||
72 | return; | ||
73 | } | ||
68 | if (NULL != record) | 74 | if (NULL != record) |
69 | { | 75 | { |
70 | count++; | 76 | count++; |
71 | return GNUNET_YES; | 77 | return; |
72 | } | 78 | } |
73 | GNUNET_assert (count == 2); | 79 | GNUNET_assert (count == 2); |
74 | count = 0; | 80 | count = 0; |
75 | GNUNET_PEERSTORE_iterate (h, ss, NULL, NULL, GNUNET_TIME_UNIT_FOREVER_REL, | 81 | ic = GNUNET_PEERSTORE_iterate (h, ss, NULL, NULL, GNUNET_TIME_UNIT_FOREVER_REL, |
76 | iter3_cb, NULL); | 82 | iter3_cb, NULL); |
77 | return GNUNET_YES; | ||
78 | } | 83 | } |
79 | 84 | ||
80 | 85 | ||
81 | static int | 86 | static void |
82 | iter1_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | 87 | iter1_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, |
83 | const char *emsg) | 88 | const char *emsg) |
84 | { | 89 | { |
85 | if (NULL != emsg) | 90 | if (NULL != emsg) |
86 | return GNUNET_NO; | 91 | { |
92 | GNUNET_PEERSTORE_iterate_cancel (ic); | ||
93 | return; | ||
94 | } | ||
87 | if (NULL != record) | 95 | if (NULL != record) |
88 | { | 96 | { |
89 | count++; | 97 | count++; |
90 | return GNUNET_YES; | 98 | return; |
91 | } | 99 | } |
92 | GNUNET_assert (count == 1); | 100 | GNUNET_assert (count == 1); |
93 | count = 0; | 101 | count = 0; |
94 | GNUNET_PEERSTORE_iterate (h, ss, &p1, NULL, GNUNET_TIME_UNIT_FOREVER_REL, | 102 | ic = GNUNET_PEERSTORE_iterate (h, ss, &p1, NULL, GNUNET_TIME_UNIT_FOREVER_REL, |
95 | iter2_cb, NULL); | 103 | iter2_cb, NULL); |
96 | return GNUNET_YES; | ||
97 | } | 104 | } |
98 | 105 | ||
99 | 106 | ||
@@ -114,7 +121,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
114 | GNUNET_PEERSTORE_store (h, ss, &p2, k3, val, strlen (val) + 1, | 121 | GNUNET_PEERSTORE_store (h, ss, &p2, k3, val, strlen (val) + 1, |
115 | GNUNET_TIME_UNIT_FOREVER_ABS, | 122 | GNUNET_TIME_UNIT_FOREVER_ABS, |
116 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL); | 123 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL); |
117 | GNUNET_PEERSTORE_iterate (h, ss, &p1, k1, GNUNET_TIME_UNIT_FOREVER_REL, | 124 | ic = GNUNET_PEERSTORE_iterate (h, ss, &p1, k1, GNUNET_TIME_UNIT_FOREVER_REL, |
118 | iter1_cb, NULL); | 125 | iter1_cb, NULL); |
119 | } | 126 | } |
120 | 127 | ||
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c index 765ae9113..06d100100 100644 --- a/src/peerstore/test_peerstore_api_sync.c +++ b/src/peerstore/test_peerstore_api_sync.c | |||
@@ -79,7 +79,7 @@ static const char *val = "test_peerstore_api_store_val"; | |||
79 | * @param emsg any error message | 79 | * @param emsg any error message |
80 | * @return #GNUNET_YES (all good, continue) | 80 | * @return #GNUNET_YES (all good, continue) |
81 | */ | 81 | */ |
82 | static int | 82 | static void |
83 | iterate_cb (void *cls, | 83 | iterate_cb (void *cls, |
84 | const struct GNUNET_PEERSTORE_Record *record, | 84 | const struct GNUNET_PEERSTORE_Record *record, |
85 | const char *emsg) | 85 | const char *emsg) |
@@ -92,12 +92,10 @@ iterate_cb (void *cls, | |||
92 | GNUNET_PEERSTORE_disconnect (h, | 92 | GNUNET_PEERSTORE_disconnect (h, |
93 | GNUNET_NO); | 93 | GNUNET_NO); |
94 | GNUNET_SCHEDULER_shutdown (); | 94 | GNUNET_SCHEDULER_shutdown (); |
95 | return GNUNET_YES; | ||
96 | } | 95 | } |
97 | rec_val = record->value; | 96 | rec_val = record->value; |
98 | GNUNET_break (0 == strcmp (rec_val, val)); | 97 | GNUNET_break (0 == strcmp (rec_val, val)); |
99 | ok = 0; | 98 | ok = 0; |
100 | return GNUNET_YES; | ||
101 | } | 99 | } |
102 | 100 | ||
103 | 101 | ||
diff --git a/src/peerstore/test_peerstore_api_watch.c b/src/peerstore/test_peerstore_api_watch.c index 27948294f..91902ba9e 100644 --- a/src/peerstore/test_peerstore_api_watch.c +++ b/src/peerstore/test_peerstore_api_watch.c | |||
@@ -35,7 +35,7 @@ static struct GNUNET_PeerIdentity p; | |||
35 | static char *k = "test_peerstore_api_watch_key"; | 35 | static char *k = "test_peerstore_api_watch_key"; |
36 | static char *val = "test_peerstore_api_watch_val"; | 36 | static char *val = "test_peerstore_api_watch_val"; |
37 | 37 | ||
38 | static int | 38 | static void |
39 | watch_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | 39 | watch_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, |
40 | const char *emsg) | 40 | const char *emsg) |
41 | { | 41 | { |
@@ -44,7 +44,6 @@ watch_cb (void *cls, const struct GNUNET_PEERSTORE_Record *record, | |||
44 | ok = 0; | 44 | ok = 0; |
45 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); | 45 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); |
46 | GNUNET_SCHEDULER_shutdown (); | 46 | GNUNET_SCHEDULER_shutdown (); |
47 | return GNUNET_YES; | ||
48 | } | 47 | } |
49 | 48 | ||
50 | 49 | ||
diff --git a/src/peerstore/test_plugin_peerstore.c b/src/peerstore/test_plugin_peerstore.c index da78b3f75..179e32b52 100644 --- a/src/peerstore/test_plugin_peerstore.c +++ b/src/peerstore/test_plugin_peerstore.c | |||
@@ -79,7 +79,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | static int | 82 | static void |
83 | test_record (void *cls, | 83 | test_record (void *cls, |
84 | const struct GNUNET_PEERSTORE_Record *record, | 84 | const struct GNUNET_PEERSTORE_Record *record, |
85 | const char *error) | 85 | const char *error) |
@@ -88,13 +88,12 @@ test_record (void *cls, | |||
88 | char* testval = "test_val"; | 88 | char* testval = "test_val"; |
89 | 89 | ||
90 | if (NULL == record) | 90 | if (NULL == record) |
91 | return GNUNET_NO; | 91 | return; |
92 | 92 | ||
93 | GNUNET_assert (0 == memcmp (record->peer, id, sizeof (struct GNUNET_PeerIdentity))); | 93 | GNUNET_assert (0 == memcmp (record->peer, id, sizeof (struct GNUNET_PeerIdentity))); |
94 | GNUNET_assert (0 == strcmp ("subsys", record->sub_system)); | 94 | GNUNET_assert (0 == strcmp ("subsys", record->sub_system)); |
95 | GNUNET_assert (0 == strcmp ("key", record->key)); | 95 | GNUNET_assert (0 == strcmp ("key", record->key)); |
96 | GNUNET_assert (0 == memcmp (testval, record->value, strlen (testval))); | 96 | GNUNET_assert (0 == memcmp (testval, record->value, strlen (testval))); |
97 | return GNUNET_YES; | ||
98 | } | 97 | } |
99 | 98 | ||
100 | 99 | ||