diff options
Diffstat (limited to 'src/peerstore/test_peerstore_api_watch.c')
-rw-r--r-- | src/peerstore/test_peerstore_api_watch.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/peerstore/test_peerstore_api_watch.c b/src/peerstore/test_peerstore_api_watch.c index 9f933f584..1e097ad42 100644 --- a/src/peerstore/test_peerstore_api_watch.c +++ b/src/peerstore/test_peerstore_api_watch.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_watch.c | 21 | * @file peerstore/test_peerstore_api_watch.c |
22 | * @brief testcase for peerstore watch functionality | 22 | * @brief testcase for peerstore watch functionality |
@@ -39,61 +39,61 @@ static char *val = "test_peerstore_api_watch_val"; | |||
39 | 39 | ||
40 | 40 | ||
41 | static void | 41 | static void |
42 | watch_cb (void *cls, | 42 | watch_cb(void *cls, |
43 | const struct GNUNET_PEERSTORE_Record *record, | 43 | const struct GNUNET_PEERSTORE_Record *record, |
44 | const char *emsg) | 44 | const char *emsg) |
45 | { | 45 | { |
46 | GNUNET_assert (NULL == emsg); | 46 | GNUNET_assert(NULL == emsg); |
47 | GNUNET_assert (0 == strcmp (val, | 47 | GNUNET_assert(0 == strcmp(val, |
48 | (char *) record->value)); | 48 | (char *)record->value)); |
49 | ok = 0; | 49 | ok = 0; |
50 | GNUNET_PEERSTORE_disconnect (h, | 50 | GNUNET_PEERSTORE_disconnect(h, |
51 | GNUNET_NO); | 51 | GNUNET_NO); |
52 | GNUNET_SCHEDULER_shutdown (); | 52 | GNUNET_SCHEDULER_shutdown(); |
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | static void | 56 | static void |
57 | run (void *cls, | 57 | run(void *cls, |
58 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 58 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
59 | struct GNUNET_TESTING_Peer *peer) | 59 | struct GNUNET_TESTING_Peer *peer) |
60 | { | 60 | { |
61 | struct GNUNET_PeerIdentity p; | 61 | struct GNUNET_PeerIdentity p; |
62 | 62 | ||
63 | h = GNUNET_PEERSTORE_connect (cfg); | 63 | h = GNUNET_PEERSTORE_connect(cfg); |
64 | GNUNET_assert (NULL != h); | 64 | GNUNET_assert(NULL != h); |
65 | memset (&p, | 65 | memset(&p, |
66 | 4, | 66 | 4, |
67 | sizeof (p)); | 67 | sizeof(p)); |
68 | GNUNET_PEERSTORE_watch (h, | 68 | GNUNET_PEERSTORE_watch(h, |
69 | ss, | 69 | ss, |
70 | &p, | 70 | &p, |
71 | k, | 71 | k, |
72 | &watch_cb, | 72 | &watch_cb, |
73 | NULL); | 73 | NULL); |
74 | GNUNET_PEERSTORE_store (h, | 74 | GNUNET_PEERSTORE_store(h, |
75 | ss, | 75 | ss, |
76 | &p, | 76 | &p, |
77 | k, | 77 | k, |
78 | val, | 78 | val, |
79 | strlen (val) + 1, | 79 | strlen(val) + 1, |
80 | GNUNET_TIME_UNIT_FOREVER_ABS, | 80 | GNUNET_TIME_UNIT_FOREVER_ABS, |
81 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 81 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
82 | NULL, | 82 | NULL, |
83 | NULL); | 83 | NULL); |
84 | } | 84 | } |
85 | 85 | ||
86 | 86 | ||
87 | int | 87 | int |
88 | main (int argc, | 88 | main(int argc, |
89 | char *argv[]) | 89 | char *argv[]) |
90 | { | 90 | { |
91 | if (0 != | 91 | if (0 != |
92 | GNUNET_TESTING_service_run ("test-gnunet-peerstore", | 92 | GNUNET_TESTING_service_run("test-gnunet-peerstore", |
93 | "peerstore", | 93 | "peerstore", |
94 | "test_peerstore_api_data.conf", | 94 | "test_peerstore_api_data.conf", |
95 | &run, | 95 | &run, |
96 | NULL)) | 96 | NULL)) |
97 | return 1; | 97 | return 1; |
98 | return ok; | 98 | return ok; |
99 | } | 99 | } |