diff options
author | Omar Tarabai <tarabai@devegypt.com> | 2014-08-04 11:06:52 +0000 |
---|---|---|
committer | Omar Tarabai <tarabai@devegypt.com> | 2014-08-04 11:06:52 +0000 |
commit | 4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b (patch) | |
tree | 05c40696267088fa94cdb0a94b3c079b38ea8ed2 /src/peerstore/test_peerstore_api_watch.c | |
parent | ef494e57d189e2b7c038104e44398d11026ff6a6 (diff) | |
download | gnunet-4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b.tar.gz gnunet-4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b.zip |
peerstore: indentation
Diffstat (limited to 'src/peerstore/test_peerstore_api_watch.c')
-rw-r--r-- | src/peerstore/test_peerstore_api_watch.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/src/peerstore/test_peerstore_api_watch.c b/src/peerstore/test_peerstore_api_watch.c index fb6cdc540..3820f68f6 100644 --- a/src/peerstore/test_peerstore_api_watch.c +++ b/src/peerstore/test_peerstore_api_watch.c | |||
@@ -36,51 +36,37 @@ 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 int |
39 | watch_cb(void *cls, | 39 | watch_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) |
40 | struct GNUNET_PEERSTORE_Record *record, | ||
41 | char *emsg) | ||
42 | { | 40 | { |
43 | GNUNET_assert(NULL == emsg); | 41 | GNUNET_assert (NULL == emsg); |
44 | GNUNET_assert(0 == strcmp(val, (char *)record->value)); | 42 | GNUNET_assert (0 == strcmp (val, (char *) record->value)); |
45 | ok = 0; | 43 | ok = 0; |
46 | GNUNET_PEERSTORE_disconnect(h, GNUNET_NO); | 44 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); |
47 | GNUNET_SCHEDULER_shutdown(); | 45 | GNUNET_SCHEDULER_shutdown (); |
48 | return GNUNET_YES; | 46 | return GNUNET_YES; |
49 | } | 47 | } |
50 | 48 | ||
49 | |||
51 | static void | 50 | static void |
52 | run (void *cls, | 51 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, |
53 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 52 | struct GNUNET_TESTING_Peer *peer) |
54 | struct GNUNET_TESTING_Peer *peer) | ||
55 | { | 53 | { |
56 | h = GNUNET_PEERSTORE_connect(cfg); | 54 | h = GNUNET_PEERSTORE_connect (cfg); |
57 | GNUNET_assert(NULL != h); | 55 | GNUNET_assert (NULL != h); |
58 | memset (&p, 4, sizeof (p)); | 56 | memset (&p, 4, sizeof (p)); |
59 | GNUNET_PEERSTORE_watch(h, | 57 | GNUNET_PEERSTORE_watch (h, ss, &p, k, &watch_cb, NULL); |
60 | ss, | 58 | GNUNET_PEERSTORE_store (h, ss, &p, k, val, strlen (val) + 1, |
61 | &p, | 59 | GNUNET_TIME_UNIT_FOREVER_ABS, |
62 | k, | 60 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL); |
63 | &watch_cb, | ||
64 | NULL); | ||
65 | GNUNET_PEERSTORE_store(h, | ||
66 | ss, | ||
67 | &p, | ||
68 | k, | ||
69 | val, | ||
70 | strlen(val) + 1, | ||
71 | GNUNET_TIME_UNIT_FOREVER_ABS, | ||
72 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | ||
73 | NULL, | ||
74 | NULL); | ||
75 | } | 61 | } |
76 | 62 | ||
63 | |||
77 | int | 64 | int |
78 | main (int argc, char *argv[]) | 65 | main (int argc, char *argv[]) |
79 | { | 66 | { |
80 | if (0 != GNUNET_TESTING_service_run ("test-gnunet-peerstore", | 67 | if (0 != |
81 | "peerstore", | 68 | GNUNET_TESTING_service_run ("test-gnunet-peerstore", "peerstore", |
82 | "test_peerstore_api_data.conf", | 69 | "test_peerstore_api_data.conf", &run, NULL)) |
83 | &run, NULL)) | ||
84 | return 1; | 70 | return 1; |
85 | return ok; | 71 | return ok; |
86 | } | 72 | } |