aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore/test_peerstore_api_sync.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-09 23:14:03 +0000
commit29e6158507a0758192075ac6ece7ba8e75ddc49a (patch)
treeb91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/peerstore/test_peerstore_api_sync.c
parent5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff)
downloadgnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz
gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/peerstore/test_peerstore_api_sync.c')
-rw-r--r--src/peerstore/test_peerstore_api_sync.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c
index ad113a778..765ae9113 100644
--- a/src/peerstore/test_peerstore_api_sync.c
+++ b/src/peerstore/test_peerstore_api_sync.c
@@ -80,7 +80,7 @@ static const char *val = "test_peerstore_api_store_val";
80 * @return #GNUNET_YES (all good, continue) 80 * @return #GNUNET_YES (all good, continue)
81 */ 81 */
82static int 82static int
83iterate_cb (void *cls, 83iterate_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)
86{ 86{
@@ -89,7 +89,7 @@ iterate_cb (void *cls,
89 GNUNET_break (NULL == emsg); 89 GNUNET_break (NULL == emsg);
90 if (NULL == record) 90 if (NULL == record)
91 { 91 {
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; 95 return GNUNET_YES;
@@ -106,17 +106,15 @@ iterate_cb (void *cls,
106 * data that should have been stored. 106 * data that should have been stored.
107 * 107 *
108 * @param cls NULL 108 * @param cls NULL
109 * @param tc unused
110 */ 109 */
111static void 110static void
112test_cont (void *cls, 111test_cont (void *cls)
113 const struct GNUNET_SCHEDULER_TaskContext *tc)
114{ 112{
115 h = GNUNET_PEERSTORE_connect (cfg); 113 h = GNUNET_PEERSTORE_connect (cfg);
116 GNUNET_PEERSTORE_iterate (h, 114 GNUNET_PEERSTORE_iterate (h,
117 subsystem, 115 subsystem,
118 &pid, key, 116 &pid, key,
119 GNUNET_TIME_UNIT_FOREVER_REL, 117 GNUNET_TIME_UNIT_FOREVER_REL,
120 &iterate_cb, NULL); 118 &iterate_cb, NULL);
121} 119}
122 120
@@ -128,15 +126,15 @@ static void
128test1 () 126test1 ()
129{ 127{
130 h = GNUNET_PEERSTORE_connect (cfg); 128 h = GNUNET_PEERSTORE_connect (cfg);
131 GNUNET_PEERSTORE_store (h, 129 GNUNET_PEERSTORE_store (h,
132 subsystem, 130 subsystem,
133 &pid, 131 &pid,
134 key, 132 key,
135 val, strlen (val) + 1, 133 val, strlen (val) + 1,
136 GNUNET_TIME_UNIT_FOREVER_ABS, 134 GNUNET_TIME_UNIT_FOREVER_ABS,
137 GNUNET_PEERSTORE_STOREOPTION_REPLACE, 135 GNUNET_PEERSTORE_STOREOPTION_REPLACE,
138 NULL, NULL); 136 NULL, NULL);
139 GNUNET_PEERSTORE_disconnect (h, 137 GNUNET_PEERSTORE_disconnect (h,
140 GNUNET_YES); 138 GNUNET_YES);
141 h = NULL; 139 h = NULL;
142 /* We need to wait a little bit to give the disconnect 140 /* We need to wait a little bit to give the disconnect
@@ -158,7 +156,7 @@ test1 ()
158 * @param peer handle to our peer (unused) 156 * @param peer handle to our peer (unused)
159 */ 157 */
160static void 158static void
161run (void *cls, 159run (void *cls,
162 const struct GNUNET_CONFIGURATION_Handle *c, 160 const struct GNUNET_CONFIGURATION_Handle *c,
163 struct GNUNET_TESTING_Peer *peer) 161 struct GNUNET_TESTING_Peer *peer)
164{ 162{
@@ -173,7 +171,7 @@ int
173main (int argc, char *argv[]) 171main (int argc, char *argv[])
174{ 172{
175 if (0 != 173 if (0 !=
176 GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", 174 GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync",
177 "peerstore", 175 "peerstore",
178 "test_peerstore_api_data.conf", 176 "test_peerstore_api_data.conf",
179 &run, NULL)) 177 &run, NULL))