]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Limit socket recv buf size - to not have so big latencies
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 20 Jan 2014 09:17:02 +0000 (10:17 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 20 Jan 2014 09:17:02 +0000 (10:17 +0100)
ugw/ugw.c

index 243fc5a3c562f891d7c74b7cc7273b8758796e4e..876d9ce3651d5a4bff0d31892f9c695f37f34080 100644 (file)
--- a/ugw/ugw.c
+++ b/ugw/ugw.c
@@ -104,6 +104,9 @@ void init_read(struct in_ctx *ctx)
 
        s = CHECK(socket(PF_CAN, SOCK_RAW, CAN_RAW));
 
+       int rcvbuf = 25000;     /* Limit rcvbuf to not have so big queueing latencies */
+       CHECK(setsockopt(s, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)));
+
        if (nonblocking) {
                int flags = CHECK(fcntl(s, F_GETFL, 0));
                CHECK(fcntl(s, F_SETFL, flags | O_NONBLOCK));