summaryrefslogtreecommitdiff
path: root/src/peerstore/perf_peerstore_store.c
diff options
context:
space:
mode:
authorOmar Tarabai <tarabai@devegypt.com>2014-08-04 11:06:52 +0000
committerOmar Tarabai <tarabai@devegypt.com>2014-08-04 11:06:52 +0000
commit4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b (patch)
tree05c40696267088fa94cdb0a94b3c079b38ea8ed2 /src/peerstore/perf_peerstore_store.c
parentef494e57d189e2b7c038104e44398d11026ff6a6 (diff)
peerstore: indentation
Diffstat (limited to 'src/peerstore/perf_peerstore_store.c')
-rw-r--r--src/peerstore/perf_peerstore_store.c76
1 files changed, 33 insertions, 43 deletions
diff --git a/src/peerstore/perf_peerstore_store.c b/src/peerstore/perf_peerstore_store.c
index bdf70272c..e97699fe2 100644
--- a/src/peerstore/perf_peerstore_store.c
+++ b/src/peerstore/perf_peerstore_store.c
@@ -40,78 +40,68 @@ static char *v = "test_peerstore_stress_val";
int count = 0;
void
-disconnect()
+disconnect ()
{
- if(NULL != h)
- GNUNET_PEERSTORE_disconnect(h, GNUNET_YES);
- GNUNET_SCHEDULER_shutdown();
+ if (NULL != h)
+ GNUNET_PEERSTORE_disconnect (h, GNUNET_YES);
+ GNUNET_SCHEDULER_shutdown ();
}
+
void
-store()
+store ()
{
- GNUNET_PEERSTORE_store(h,
- ss,
- &p,
- k,
- v,
- strlen(v) + 1,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- (count == 0) ? GNUNET_PEERSTORE_STOREOPTION_REPLACE : GNUNET_PEERSTORE_STOREOPTION_MULTIPLE,
- NULL,
- NULL);
+ GNUNET_PEERSTORE_store (h, ss, &p, k, v, strlen (v) + 1,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ (count ==
+ 0) ? GNUNET_PEERSTORE_STOREOPTION_REPLACE :
+ GNUNET_PEERSTORE_STOREOPTION_MULTIPLE, NULL, NULL);
count++;
}
+
static int
-watch_cb(void *cls,
- struct GNUNET_PEERSTORE_Record *record,
- char *emsg)
+watch_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg)
{
- GNUNET_assert(NULL == emsg);
- if(STORES == count)
+ GNUNET_assert (NULL == emsg);
+ if (STORES == count)
{
ok = 0;
- disconnect();
+ disconnect ();
}
else
- store();
+ store ();
return GNUNET_YES;
}
+
static void
-run (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Peer *peer)
+run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
{
memset (&p, 5, sizeof (p));
- h = GNUNET_PEERSTORE_connect(cfg);
- GNUNET_assert(NULL != h);
- GNUNET_PEERSTORE_watch(h,
- ss,
- &p,
- k,
- &watch_cb,
- NULL);
- store();
+ h = GNUNET_PEERSTORE_connect (cfg);
+ GNUNET_assert (NULL != h);
+ GNUNET_PEERSTORE_watch (h, ss, &p, k, &watch_cb, NULL);
+ store ();
}
+
int
main (int argc, char *argv[])
{
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Relative diff;
- start = GNUNET_TIME_absolute_get();
- if (0 != GNUNET_TESTING_service_run ("perf-peerstore-store",
- "peerstore",
- "test_peerstore_api_data.conf",
- &run, NULL))
+ start = GNUNET_TIME_absolute_get ();
+ if (0 !=
+ GNUNET_TESTING_service_run ("perf-peerstore-store", "peerstore",
+ "test_peerstore_api_data.conf", &run, NULL))
return 1;
- diff = GNUNET_TIME_absolute_get_duration(start);
- fprintf(stderr, "Stored and retrieved %d records in %s (%s).\n",
- STORES, GNUNET_STRINGS_relative_time_to_string(diff, GNUNET_YES),
- GNUNET_STRINGS_relative_time_to_string(diff, GNUNET_NO));
+ diff = GNUNET_TIME_absolute_get_duration (start);
+ fprintf (stderr, "Stored and retrieved %d records in %s (%s).\n", STORES,
+ GNUNET_STRINGS_relative_time_to_string (diff, GNUNET_YES),
+ GNUNET_STRINGS_relative_time_to_string (diff, GNUNET_NO));
return ok;
}