summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
commit416c2f5a713b93ba689a8cd1e038682a53e6bc17 (patch)
tree987f51d9edfddc02afe1524df5e1156b920c71d4 /src/transport
parentfceec98e767bce7ad2c24dde73cdcf8837e04013 (diff)
-LRN: use FPRINTF -- #2051
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-transport-connect-running-peers.c4
-rw-r--r--src/transport/gnunet-transport.c28
-rw-r--r--src/transport/test_quota_compliance.c10
-rw-r--r--src/transport/test_transport_api.c2
-rw-r--r--src/transport/test_transport_api_bidirectional_connect.c2
-rw-r--r--src/transport/test_transport_api_disconnect.c2
-rw-r--r--src/transport/test_transport_api_limited_sockets.c2
-rw-r--r--src/transport/test_transport_api_reliability.c8
-rw-r--r--src/transport/test_transport_api_restart_1peer.c2
-rw-r--r--src/transport/test_transport_api_restart_2peers.c2
-rw-r--r--src/transport/test_transport_api_timeout.c6
-rw-r--r--src/transport/test_transport_api_unreliability.c8
-rw-r--r--src/transport/test_transport_api_unreliability_constant.c10
-rw-r--r--src/transport/test_transport_startonly.c6
14 files changed, 46 insertions, 46 deletions
diff --git a/src/transport/gnunet-transport-connect-running-peers.c b/src/transport/gnunet-transport-connect-running-peers.c
index 172f34b27..8ba81891f 100644
--- a/src/transport/gnunet-transport-connect-running-peers.c
+++ b/src/transport/gnunet-transport-connect-running-peers.c
@@ -73,7 +73,7 @@ char *cfg_file_p1;
char *cfg_file_p2;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
@@ -368,7 +368,7 @@ main (int argc, char *argv[])
if (argc < 3)
{
- fprintf (stderr,
+ FPRINTF (stderr,
"usage gnunet-transport-connect-running-peers <cfg_peer1> <cfg_peer2>\n");
return -1;
}
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 02a5ee492..17a21dd28 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -167,11 +167,11 @@ display_test_result (struct TestContext *tc, int result)
{
if (GNUNET_YES != result)
{
- fprintf (stderr, "Configuration for plugin `%s' did not work!\n", tc->name);
+ FPRINTF (stderr, "Configuration for plugin `%s' did not work!\n", tc->name);
}
else
{
- fprintf (stderr, "Configuration for plugin `%s' is working!\n", tc->name);
+ FPRINTF (stderr, "Configuration for plugin `%s' is working!\n", tc->name);
}
if (GNUNET_SCHEDULER_NO_TASK != tc->tsk)
{
@@ -245,9 +245,9 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins",
&plugins))
{
- fprintf (stderr,
+ FPRINTF (stderr,
_
- ("No transport plugins configured, peer will never communicate\n"));
+ ("No transport plugins configured, peer will never communicate\n"), NULL);
ret = 4;
return;
}
@@ -259,7 +259,7 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, section, "PORT", &bnd_port))
{
- fprintf (stderr,
+ FPRINTF (stderr,
_("No port configured for plugin `%s', cannot test it\n"), tok);
continue;
}
@@ -310,14 +310,14 @@ do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (benchmark_receive)
{
duration = GNUNET_TIME_absolute_get_duration (start_time);
- fprintf (stdout, _("Received %llu bytes/s (%llu bytes in %llu ms)\n"),
+ FPRINTF (stdout, _("Received %llu bytes/s (%llu bytes in %llu ms)\n"),
1000 * traffic_received / (1 + duration.rel_value),
traffic_received, (unsigned long long) duration.rel_value);
}
if (benchmark_send)
{
duration = GNUNET_TIME_absolute_get_duration (start_time);
- fprintf (stdout, _("Transmitted %llu bytes/s (%llu bytes in %llu ms)\n"),
+ FPRINTF (stdout, _("Transmitted %llu bytes/s (%llu bytes in %llu ms)\n"),
1000 * traffic_sent / (1 + duration.rel_value), traffic_sent,
(unsigned long long) duration.rel_value);
}
@@ -350,7 +350,7 @@ transmit_data (void *cls, size_t size, void *buf)
GNUNET_TIME_UNIT_FOREVER_REL,
&transmit_data, NULL);
if (verbosity > 0)
- fprintf (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size,
+ FPRINTF (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size,
GNUNET_i2s (&pid));
return size;
}
@@ -370,7 +370,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
{
if (verbosity > 0)
- fprintf (stdout, _("Connected to %s\n"), GNUNET_i2s (peer));
+ FPRINTF (stdout, _("Connected to %s\n"), GNUNET_i2s (peer));
if (0 != memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
ret = 0;
@@ -401,7 +401,7 @@ static void
notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
{
if (verbosity > 0)
- fprintf (stdout, _("Disconnected from %s\n"), GNUNET_i2s (peer));
+ FPRINTF (stdout, _("Disconnected from %s\n"), GNUNET_i2s (peer));
if ((0 == memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity))) &&
(NULL != th))
{
@@ -430,7 +430,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
if (!benchmark_receive)
return;
if (verbosity > 0)
- fprintf (stdout, _("Received %u bytes from %s\n"),
+ FPRINTF (stdout, _("Received %u bytes from %s\n"),
(unsigned int) ntohs (message->size), GNUNET_i2s (peer));
if (traffic_received == 0)
start_time = GNUNET_TIME_absolute_get ();
@@ -444,7 +444,7 @@ process_string (void *cls, const char *address)
if ((address != NULL))
{
- fprintf (stdout, _("Peer `%s': %s %s\n"), GNUNET_i2s (&addrcp->peer), addrcp->transport_name, address);
+ FPRINTF (stdout, _("Peer `%s': %s %s\n"), GNUNET_i2s (&addrcp->peer), addrcp->transport_name, address);
}
else
{
@@ -499,7 +499,7 @@ run (void *cls, char *const *args, const char *cfgfile,
}
if (benchmark_send && (NULL == cpid))
{
- fprintf (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
+ FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
"-s", "-C");
return;
}
@@ -508,7 +508,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ret = 1;
if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (cpid, &pid.hashPubKey))
{
- fprintf (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
+ FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
return;
}
handle =
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 5d9cfff19..0ef708b62 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -130,7 +130,7 @@ static struct GNUNET_TIME_Absolute start_time;
*/
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
@@ -147,7 +147,7 @@ end ()
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
datarate = (total_bytes_sent * 1000) / delta;
- fprintf (stderr, "Throughput was %llu b/s\n", datarate);
+ FPRINTF (stderr, "Throughput was %llu b/s\n", datarate);
test_failed = GNUNET_NO;
if (datarate > quota_in_p2)
@@ -365,7 +365,7 @@ notify_ready (void *cls, size_t size, void *buf)
total_bytes_sent += ret;
if (n == TOTAL_MSGS)
{
- fprintf (stderr, "\n");
+ FPRINTF (stderr, "%s", "\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages sent\n");
}
return ret;
@@ -417,12 +417,12 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
counter++;
if ((DURATION.rel_value / 1000) < counter)
{
- fprintf (stderr, ".\n");
+ FPRINTF (stderr, "%s", ".\n");
GNUNET_SCHEDULER_add_now (&end, NULL);
}
else
{
- fprintf (stderr, ".");
+ FPRINTF (stderr, "%s", ".");
measure_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &measure, NULL);
}
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index dd0704231..1058f2b6b 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -81,7 +81,7 @@ char *cfg_file_p1;
char *cfg_file_p2;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c
index 20005deab..b4a3ca41d 100644
--- a/src/transport/test_transport_api_bidirectional_connect.c
+++ b/src/transport/test_transport_api_bidirectional_connect.c
@@ -80,7 +80,7 @@ char *cfg_file_p1;
char *cfg_file_p2;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c
index 026ed085a..1a73bcb5f 100644
--- a/src/transport/test_transport_api_disconnect.c
+++ b/src/transport/test_transport_api_disconnect.c
@@ -80,7 +80,7 @@ char *cfg_file_p1;
char *cfg_file_p2;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index 7fb13e261..d1aa6e40d 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -84,7 +84,7 @@ char *cfg_file_p1;
char *cfg_file_p2;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index ac360a3ea..eb03564d5 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -123,7 +123,7 @@ static struct GNUNET_TIME_Absolute start_time;
*/
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
@@ -139,7 +139,7 @@ end ()
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
- fprintf (stderr, "\nThroughput was %llu kb/s\n",
+ FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
total_bytes * 1000 / 1024 / delta);
GNUNET_asprintf (&value_name, "reliable_%s", test_plugin);
GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
@@ -267,7 +267,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
n++;
if (0 == (n % (TOTAL_MSGS / 100)))
{
- fprintf (stderr, ".");
+ FPRINTF (stderr, "%s", ".");
if (die_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
@@ -353,7 +353,7 @@ notify_ready (void *cls, size_t size, void *buf)
total_bytes += ret;
if (n == TOTAL_MSGS)
{
- fprintf (stderr, "\n");
+ FPRINTF (stderr, "%s", "\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages sent\n");
}
return ret;
diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c
index 61423a7ee..22c603565 100644
--- a/src/transport/test_transport_api_restart_1peer.c
+++ b/src/transport/test_transport_api_restart_1peer.c
@@ -80,7 +80,7 @@ char *cfg_file_p2;
static int restarted;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c
index 67cc90f0e..3de91d62a 100644
--- a/src/transport/test_transport_api_restart_2peers.c
+++ b/src/transport/test_transport_api_restart_2peers.c
@@ -80,7 +80,7 @@ char *cfg_file_p2;
static int restarted;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c
index 29f7dd4af..35279ff76 100644
--- a/src/transport/test_transport_api_timeout.c
+++ b/src/transport/test_transport_api_timeout.c
@@ -87,7 +87,7 @@ static int disconnects;
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
@@ -210,13 +210,13 @@ timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (time_running.rel_value ==
GNUNET_TIME_relative_max (time_running, WAIT).rel_value)
{
- fprintf (stderr, "100%%\n");
+ FPRINTF (stderr, "%s", "100%%\n");
shutdown_flag = GNUNET_YES;
GNUNET_SCHEDULER_add_now (&end, NULL);
}
else
{
- fprintf (stderr, "%u%%..", percentage);
+ FPRINTF (stderr, "%u%%..", percentage);
timer_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
&timer, NULL);
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index 2120f7044..413daabc9 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -126,7 +126,7 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
*/
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
@@ -144,7 +144,7 @@ end ()
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
- fprintf (stderr, "\nThroughput was %llu kb/s\n",
+ FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
total_bytes * 1000 / 1024 / delta);
GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin);
GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
@@ -337,7 +337,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
test_sending = GNUNET_YES;
if (0 == (n % (TOTAL_MSGS / 100)))
{
- fprintf (stderr, ".");
+ FPRINTF (stderr, "%s", ".");
if (GNUNET_SCHEDULER_NO_TASK != die_task)
GNUNET_SCHEDULER_cancel (die_task);
die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
@@ -410,7 +410,7 @@ notify_ready (void *cls, size_t size, void *buf)
}
else
{
- fprintf (stderr, "\n");
+ FPRINTF (stderr, "%s", "\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages scheduled to be sent\n");
if (GNUNET_SCHEDULER_NO_TASK != die_task)
GNUNET_SCHEDULER_cancel (die_task);
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c
index 3770ebfdb..52bf63833 100644
--- a/src/transport/test_transport_api_unreliability_constant.c
+++ b/src/transport/test_transport_api_unreliability_constant.c
@@ -124,7 +124,7 @@ static struct GNUNET_TIME_Absolute start_time;
*/
#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
#define OKPP do { ok++; } while (0)
#endif
@@ -142,7 +142,7 @@ end ()
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
- fprintf (stderr, "\nThroughput was %llu kb/s\n",
+ FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
total_bytes * 1000 / 1024 / delta);
GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin);
GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
@@ -281,7 +281,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
n++;
if (0 == (n % (TOTAL_MSGS / 100)))
{
- fprintf (stderr, ".");
+ FPRINTF (stderr, "%s", ".");
if (GNUNET_SCHEDULER_NO_TASK != die_task)
GNUNET_SCHEDULER_cancel (die_task);
test_failed = GNUNET_YES;
@@ -291,7 +291,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
{
/* because of starting with 0 */
msg_recv++;
- fprintf (stderr, "\n");
+ FPRINTF (stderr, "%s", "\n");
end ();
}
}
@@ -356,7 +356,7 @@ notify_ready (void *cls, size_t size, void *buf)
}
else
{
- fprintf (stderr, "\n");
+ FPRINTF (stderr, "%s", "\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"All messages scheduled to be sent!!\n");
if (GNUNET_SCHEDULER_NO_TASK != die_task)
diff --git a/src/transport/test_transport_startonly.c b/src/transport/test_transport_startonly.c
index c6215c9bc..36d9b18d3 100644
--- a/src/transport/test_transport_startonly.c
+++ b/src/transport/test_transport_startonly.c
@@ -124,7 +124,7 @@ run (void *cls, char *const *args, const char *cfgfile,
timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
i = 1;
- fprintf (stderr, "%i", i);
+ FPRINTF (stderr, "%i", i);
while (i <= ITERATIONS)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting peer\n");
@@ -147,12 +147,12 @@ run (void *cls, char *const *args, const char *cfgfile,
i++;
if (i <= ITERATIONS)
- fprintf (stderr, "..%i", i);
+ FPRINTF (stderr, "..%i", i);
}
tth = GNUNET_TRANSPORT_TESTING_init ();
- fprintf (stderr, "\n");
+ FPRINTF (stderr, "%s", "\n");
end ();
}