summaryrefslogtreecommitdiff
path: root/src/client.c
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2016-07-01 10:37:31 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2016-07-01 10:37:31 -0400
commit7779e8c4b21fde71f828841c03ab29d7b62575ff (patch)
tree6963373a1570b07a9a6e64b01bfaeaeef2d217d8 /src/client.c
parentd3cdeebaf817a65f25772fd491e8c20556dd0f52 (diff)
downloadudpastcp-7779e8c4b21fde71f828841c03ab29d7b62575ff.tar.xz
udpastcp-7779e8c4b21fde71f828841c03ab29d7b62575ff.zip
Fix server->client communication.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c
index 10ba78a..3967950 100644
--- a/src/client.c
+++ b/src/client.c
@@ -122,6 +122,8 @@ static void c_sock_cleanup(EV_P_ struct o_c_sock *sock, int stopping) {
} else if ((size_t)sz != sizeof(buf)) {
fprintf(stderr, "send %s our packet: tried %lu, sent %zd\n", (size_t)sz > sizeof(buf) ? "expanded" : "truncated", sizeof(buf), sz);
}
+
+ return;
}
if (!stopping) {
@@ -252,10 +254,10 @@ static void cc_cb(struct ev_loop *loop __attribute__((unused)), ev_io *w, int re
ev_timer_start(EV_A_ &sock->tm_w);
}
- should_ssz = rsz - ntohs(rhdr->th_off) * 32 / CHAR_BIT;
+ should_ssz = rsz - rhdr->th_off * 32 / CHAR_BIT;
if (should_ssz > 0) {
DBG("sending %zd bytes to client", should_ssz);
- ssz = sendto(rsock->c_data->s_sock, rbuf + ntohs(rhdr->th_off) * 32 / CHAR_BIT, should_ssz, 0, sock->c_address, rsock->c_data->s_addrlen);
+ ssz = sendto(rsock->c_data->s_sock, rbuf + rhdr->th_off * 32 / CHAR_BIT, should_ssz, 0, sock->c_address, rsock->c_data->s_addrlen);
if (ssz < 0) {
perror("sendto");