X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsptps_test.c;h=ea81a28dc0d0d5e46e3992e852e687908790dcfb;hb=de7d5a03c2b956ab5753faf63b8148a279a71f29;hp=4ff701efc8a76f33faf5c846ce292c10449665c4;hpb=1c475ecb575367a6b3f9328b0f643ad636155341;p=tinc diff --git a/src/sptps_test.c b/src/sptps_test.c index 4ff701ef..ea81a28d 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -78,6 +78,7 @@ static bool send_data(void *handle, uint8_t type, const void *data, size_t len) static bool receive_record(void *handle, uint8_t type, const void *data, uint16_t len) { (void)handle; + if(verbose) { fprintf(stderr, "Received type %d record of %u bytes:\n", type, len); } @@ -369,6 +370,7 @@ int main(int argc, char *argv[]) { } char buf[65535] = ""; + size_t readsize = datagram ? 1460u : sizeof(buf); fd_set fds; FD_ZERO(&fds); @@ -386,7 +388,7 @@ int main(int argc, char *argv[]) { } if(FD_ISSET(in, &fds)) { - ssize_t len = read(in, buf, sizeof(buf)); + ssize_t len = read(in, buf, readsize); if(len < 0) { fprintf(stderr, "Could not read from stdin: %s\n", strerror(errno));