Commit 14d456ad authored by Pekka Pessi's avatar Pekka Pessi

su/test_su_osx.c: fixed whitespace

darcs-hash:20081127130735-db55f-3705122874f27e706cd4dcf2795a6a1dcb9f2236.gz
parent 802a27b7
......@@ -30,7 +30,7 @@
*
* @author Martti Mela <Martti.Mela@nokia.com>
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
*
* @date Created: Tue Sep 26 17:16:02 EEST 2006 mela
*/
......@@ -96,13 +96,13 @@ short opt_root_run = 0;
/* For run loop */
int running = 0;
static su_socket_t udpsocket(void)
static su_socket_t udpsocket(void)
{
su_socket_t s;
su_sockaddr_t su = { 0 };
socklen_t sulen = sizeof(su);
char nbuf[64];
enter;
su.su_family = opt_family;
......@@ -122,7 +122,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)
......@@ -144,7 +144,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];
......@@ -159,7 +159,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");
}
......@@ -223,7 +223,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");
}
......@@ -467,7 +467,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(),
......@@ -483,8 +483,8 @@ int main(int argc, char *argv[])
su_timer_t *t;
unsigned long sleeppid = 0;
struct pinger
pinger = { PINGER, "ping", 1 },
struct pinger
pinger = { PINGER, "ping", 1 },
ponger = { PONGER, "pong", 1 };
char *argv0 = argv[0];
......@@ -528,16 +528,16 @@ int main(int argc, char *argv[])
time_test();
root = su_root_osx_runloop_create(NULL);
root = su_root_osx_runloop_create(NULL);
if (!root) perror("su_root_osx_runloop_create"), exit(1);
su_root_threading(root, 0 && !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), 2000L);
......@@ -545,7 +545,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);
......@@ -557,20 +557,20 @@ int main(int argc, char *argv[])
while (running == 1) {
su_root_step(root, 20);
}
su_clone_wait(root, ping);
su_clone_wait(root, pong);
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);
#ifndef HAVE_WIN32
if (sleeppid)
......
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