X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=selftest.c;h=f6e4c8c4ce5abfa488964fca5776282fe46d58c3;hb=2ae2f9bbb7502589f279c329815d55ec526baffd;hp=2c299437388e3d6cef3700860f7f3397bd6a70ea;hpb=d5888c10a181d6247e407f480524d36be6319b3e;p=utcp diff --git a/selftest.c b/selftest.c index 2c29943..f6e4c8c 100644 --- a/selftest.c +++ b/selftest.c @@ -10,7 +10,7 @@ struct utcp *a; struct utcp *b; struct utcp_connection *c; -int do_recv(struct utcp_connection *x, const void *data, size_t len) { +ssize_t do_recv(struct utcp_connection *x, const void *data, size_t len) { if(!len) { if(errno) fprintf(stderr, "%p Error: %s\n", x->utcp, strerror(errno)); @@ -24,11 +24,9 @@ int do_recv(struct utcp_connection *x, const void *data, size_t len) { } if(x == c) - write(0, data, len); + return write(0, data, len); else - utcp_send(x, data, len); - - return 0; + return utcp_send(x, data, len); } bool do_pre_accept(struct utcp *utcp, uint16_t port) { @@ -43,7 +41,7 @@ void do_accept(struct utcp_connection *c, uint16_t port) { utcp_accept(c, do_recv, NULL); } -int do_send(struct utcp *utcp, const void *data, size_t len) { +ssize_t do_send(struct utcp *utcp, const void *data, size_t len) { static int count = 0; if(++count > 1000) { fprintf(stderr, "Too many packets!\n");