aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore/test_peerstore_api_sync.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-09-08 12:33:09 +0000
committerng0 <ng0@n0.is>2019-09-08 12:33:09 +0000
commitd41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch)
tree9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/peerstore/test_peerstore_api_sync.c
parenta0fce305c565c0937d917a92712f15e9c5736260 (diff)
downloadgnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz
gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip
uncrustify as demanded.
Diffstat (limited to 'src/peerstore/test_peerstore_api_sync.c')
-rw-r--r--src/peerstore/test_peerstore_api_sync.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c
index 6fe12335e..7df4778be 100644
--- a/src/peerstore/test_peerstore_api_sync.c
+++ b/src/peerstore/test_peerstore_api_sync.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file peerstore/test_peerstore_api_sync.c 21 * @file peerstore/test_peerstore_api_sync.c
22 * @brief testcase for peerstore sync-on-disconnect feature. Stores 22 * @brief testcase for peerstore sync-on-disconnect feature. Stores
@@ -80,22 +80,22 @@ 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 void 82static void
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{
87 const char *rec_val; 87 const char *rec_val;
88 88
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; 95 return;
96 } 96 }
97 rec_val = record->value; 97 rec_val = record->value;
98 GNUNET_break (0 == strcmp (rec_val, val)); 98 GNUNET_break(0 == strcmp(rec_val, val));
99 ok = 0; 99 ok = 0;
100} 100}
101 101
@@ -107,14 +107,14 @@ iterate_cb (void *cls,
107 * @param cls NULL 107 * @param cls NULL
108 */ 108 */
109static void 109static void
110test_cont (void *cls) 110test_cont(void *cls)
111{ 111{
112 h = GNUNET_PEERSTORE_connect (cfg); 112 h = GNUNET_PEERSTORE_connect(cfg);
113 GNUNET_PEERSTORE_iterate (h, 113 GNUNET_PEERSTORE_iterate(h,
114 subsystem, 114 subsystem,
115 &pid, key, 115 &pid, key,
116 &iterate_cb, 116 &iterate_cb,
117 NULL); 117 NULL);
118} 118}
119 119
120 120
@@ -122,28 +122,28 @@ test_cont (void *cls)
122 * Actually run the test. 122 * Actually run the test.
123 */ 123 */
124static void 124static void
125test1 () 125test1()
126{ 126{
127 h = GNUNET_PEERSTORE_connect (cfg); 127 h = GNUNET_PEERSTORE_connect(cfg);
128 GNUNET_PEERSTORE_store (h, 128 GNUNET_PEERSTORE_store(h,
129 subsystem, 129 subsystem,
130 &pid, 130 &pid,
131 key, 131 key,
132 val, strlen (val) + 1, 132 val, strlen(val) + 1,
133 GNUNET_TIME_UNIT_FOREVER_ABS, 133 GNUNET_TIME_UNIT_FOREVER_ABS,
134 GNUNET_PEERSTORE_STOREOPTION_REPLACE, 134 GNUNET_PEERSTORE_STOREOPTION_REPLACE,
135 NULL, NULL); 135 NULL, NULL);
136 GNUNET_PEERSTORE_disconnect (h, 136 GNUNET_PEERSTORE_disconnect(h,
137 GNUNET_YES); 137 GNUNET_YES);
138 h = NULL; 138 h = NULL;
139 /* We need to wait a little bit to give the disconnect 139 /* We need to wait a little bit to give the disconnect
140 a chance to actually finish the operation; otherwise, 140 a chance to actually finish the operation; otherwise,
141 the test may fail non-deterministically if the new 141 the test may fail non-deterministically if the new
142 connection is faster than the cleanup routine of the 142 connection is faster than the cleanup routine of the
143 old one. */ 143 old one. */
144 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 144 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS,
145 &test_cont, 145 &test_cont,
146 NULL); 146 NULL);
147} 147}
148 148
149 149
@@ -155,29 +155,29 @@ test1 ()
155 * @param peer handle to our peer (unused) 155 * @param peer handle to our peer (unused)
156 */ 156 */
157static void 157static void
158run (void *cls, 158run(void *cls,
159 const struct GNUNET_CONFIGURATION_Handle *c, 159 const struct GNUNET_CONFIGURATION_Handle *c,
160 struct GNUNET_TESTING_Peer *peer) 160 struct GNUNET_TESTING_Peer *peer)
161{ 161{
162 cfg = c; 162 cfg = c;
163 memset (&pid, 1, sizeof (pid)); 163 memset(&pid, 1, sizeof(pid));
164 test1 (); 164 test1();
165} 165}
166 166
167 167
168int 168int
169main (int argc, char *argv[]) 169main(int argc, char *argv[])
170{ 170{
171 if (0 != 171 if (0 !=
172 GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", 172 GNUNET_TESTING_service_run("test-gnunet-peerstore-sync",
173 "peerstore", 173 "peerstore",
174 "test_peerstore_api_data.conf", 174 "test_peerstore_api_data.conf",
175 &run, NULL)) 175 &run, NULL))
176 return 1; 176 return 1;
177 if (0 != ok) 177 if (0 != ok)
178 fprintf (stderr, 178 fprintf(stderr,
179 "Test failed: %d\n", 179 "Test failed: %d\n",
180 ok); 180 ok);
181 return ok; 181 return ok;
182} 182}
183 183