Commit 802a27b7 authored by Pekka Pessi's avatar Pekka Pessi

su/test_su.c: fixed whitespace

darcs-hash:20081127130734-db55f-591f8ecebfa550df1268204de8f071ca7d07081a.gz
parent 547e9d2a
......@@ -30,7 +30,7 @@
* @internal
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
*
* @date Created: Thu Mar 18 19:40:51 1999 pessi
*/
......@@ -87,7 +87,7 @@ short opt_family = AF_INET;
short opt_verbatim = 0;
short opt_singlethread = 0;
static su_socket_t udpsocket(void)
static su_socket_t udpsocket(void)
{
su_socket_t s;
su_sockaddr_t su = { 0 };
......@@ -111,7 +111,7 @@ static su_socket_t udpsocket(void)
if (getsockname(s, &su.su_sa, &sulen) == SOCKET_ERROR) {
su_perror("udpsocket: getsockname");
exit(1);
exit(1);
}
if (opt_verbatim)
......@@ -131,7 +131,7 @@ static char *snow(su_time_t now)
return buf;
}
void
void
do_ping(struct pinger *p, su_timer_t *t, void *p0)
{
char buf[1024];
......@@ -142,7 +142,7 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
p->when = su_now();
snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
if (su_sendto(p->s, buf, strlen(buf), 0,
if (su_sendto(p->s, buf, strlen(buf), 0,
&p->addr, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_ping: send");
}
......@@ -202,7 +202,7 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
p->id = 0;
snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
if (su_sendto(p->s, buf, strlen(buf), 0,
if (su_sendto(p->s, buf, strlen(buf), 0,
&p->addr, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_pong: send");
}
......@@ -472,7 +472,7 @@ usage(int exitcode)
/*
* test su_wait functionality:
*
* Create a ponger, waking up do_recv() when data arrives,
* Create a ponger, waking up do_recv() when data arrives,
* then scheduling do_pong() by timer
*
* Create a pinger, executed from timer, scheduling do_ping(),
......@@ -490,8 +490,8 @@ int main(int argc, char *argv[])
int opt_alarm = 1;
#endif
struct pinger
pinger = { PINGER, "ping", 1 },
struct pinger
pinger = { PINGER, "ping", 1 },
ponger = { PONGER, "pong", 1 };
char *argv0 = argv[0];
......@@ -545,13 +545,13 @@ int main(int argc, char *argv[])
fprintf(stdout, "test_su: testing %s port implementation\n",
su_root_name(root));
su_root_threading(root, !opt_singlethread);
if (su_clone_start(root, ping, &pinger, do_init, do_destroy) != 0)
perror("su_clone_start"), exit(1);
if (su_clone_start(root, pong, &ponger, do_init, do_destroy) != 0)
perror("su_clone_start"), exit(1);
perror("su_clone_start"), exit(1);
/* Test timer, exiting after 200 milliseconds */
t = su_timer_create(su_root_task(root), 200L);
......@@ -559,7 +559,7 @@ int main(int argc, char *argv[])
su_perror("su_timer_create"), exit(1);
su_timer_set(t, (su_timer_f)do_exit, NULL);
su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong),
su_msg_create(start_msg, su_clone_task(ping), su_clone_task(pong),
init_ping, 0);
su_msg_send(start_msg);
......@@ -571,13 +571,13 @@ int main(int argc, char *argv[])
su_timer_destroy(t);
if (pinger.rtt_n) {
printf("%s executed %u pings in %g, mean rtt=%g sec\n", name,
printf("%s executed %u pings in %g, mean rtt=%g sec\n", name,
pinger.rtt_n, pinger.rtt_total, pinger.rtt_total / pinger.rtt_n);
}
su_root_destroy(root);
if (opt_verbatim)
printf("%s exiting\n", argv0);
printf("%s exiting\n", argv0);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment