Commit 556148a3 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

su tests: use su_sendto() and su_sockaddr_t.

darcs-hash:20061122075108-65a35-4b2549a99f3d1a6456cac738006d85e8be0f8de8.gz
parent 72a148a4
...@@ -143,8 +143,8 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0) ...@@ -143,8 +143,8 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
p->when = su_now(); p->when = su_now();
snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when)); snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
if (sendto(p->s, buf, strlen(buf), 0, if (su_sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) { &p->addr, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_ping: send"); su_perror("do_ping: send");
} }
...@@ -203,8 +203,8 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0) ...@@ -203,8 +203,8 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
p->id = 0; p->id = 0;
snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now())); snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
if (sendto(p->s, buf, strlen(buf), 0, if (su_sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) { &p->addr, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_pong: send"); su_perror("do_pong: send");
} }
......
...@@ -159,8 +159,8 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0) ...@@ -159,8 +159,8 @@ do_ping(struct pinger *p, su_timer_t *t, void *p0)
p->when = su_now(); p->when = su_now();
snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when)); snprintf(buf, sizeof(buf), "Ping %d at %s", p->id++, snow(p->when));
if (sendto(p->s, buf, strlen(buf), 0, if (su_sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) { &p->addr, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_ping: send"); su_perror("do_ping: send");
} }
...@@ -223,8 +223,8 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0) ...@@ -223,8 +223,8 @@ do_pong(struct pinger *p, su_timer_t *t, void *p0)
p->id = 0; p->id = 0;
snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now())); snprintf(buf, sizeof(buf), "Pong at %s", snow(su_now()));
if (sendto(p->s, buf, strlen(buf), 0, if (su_sendto(p->s, buf, strlen(buf), 0,
&p->addr.su_sa, su_sockaddr_size(&p->addr)) == -1) { &p->addr, su_sockaddr_size(&p->addr)) == -1) {
su_perror("do_pong: send"); su_perror("do_pong: send");
} }
......
...@@ -208,8 +208,7 @@ static int register_test(root_test_t *rt) ...@@ -208,8 +208,7 @@ static int register_test(root_test_t *rt)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
test_ep_t *ep = rt->rt_ep[i]; test_ep_t *ep = rt->rt_ep[i];
TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
&ep->addr->su_sa, ep->addrlen),
sizeof(msg)); sizeof(msg));
test_run(rt); test_run(rt);
TEST(rt->rt_received, i); TEST(rt->rt_received, i);
...@@ -232,8 +231,7 @@ static int register_test(root_test_t *rt) ...@@ -232,8 +231,7 @@ static int register_test(root_test_t *rt)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
test_ep_t *ep = rt->rt_ep[i]; test_ep_t *ep = rt->rt_ep[i];
TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
&ep->addr->su_sa, ep->addrlen),
sizeof(msg)); sizeof(msg));
test_run(rt); test_run(rt);
TEST(rt->rt_received, i); TEST(rt->rt_received, i);
...@@ -256,8 +254,7 @@ static int register_test(root_test_t *rt) ...@@ -256,8 +254,7 @@ static int register_test(root_test_t *rt)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
test_ep_t *ep = rt->rt_ep[i]; test_ep_t *ep = rt->rt_ep[i];
TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, TEST_SIZE(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
&ep->addr->su_sa, ep->addrlen),
sizeof(msg)); sizeof(msg));
test_run(rt); test_run(rt);
TEST(rt->rt_received, i); TEST(rt->rt_received, i);
......
...@@ -210,7 +210,7 @@ static int register_test(root_test_t *rt) ...@@ -210,7 +210,7 @@ static int register_test(root_test_t *rt)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
test_ep_t *ep = rt->rt_ep[i]; test_ep_t *ep = rt->rt_ep[i];
TEST(sendto(s, msg, sizeof(msg), 0, &ep->addr->su_sa, ep->addrlen), TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
sizeof(msg)); sizeof(msg));
test_run(rt); test_run(rt);
TEST(rt->rt_received, i); TEST(rt->rt_received, i);
...@@ -233,7 +233,7 @@ static int register_test(root_test_t *rt) ...@@ -233,7 +233,7 @@ static int register_test(root_test_t *rt)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
test_ep_t *ep = rt->rt_ep[i]; test_ep_t *ep = rt->rt_ep[i];
TEST(sendto(s, msg, sizeof(msg), 0, &ep->addr->su_sa, ep->addrlen), TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
sizeof(msg)); sizeof(msg));
test_run(rt); test_run(rt);
TEST(rt->rt_received, i); TEST(rt->rt_received, i);
...@@ -256,7 +256,7 @@ static int register_test(root_test_t *rt) ...@@ -256,7 +256,7 @@ static int register_test(root_test_t *rt)
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
test_ep_t *ep = rt->rt_ep[i]; test_ep_t *ep = rt->rt_ep[i];
TEST(sendto(s, msg, sizeof(msg), 0, &ep->addr->su_sa, ep->addrlen), TEST(su_sendto(s, msg, sizeof(msg), 0, ep->addr, ep->addrlen),
sizeof(msg)); sizeof(msg));
test_run(rt); test_run(rt);
TEST(rt->rt_received, i); TEST(rt->rt_received, i);
......
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