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 243fc5a..876d9ce 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));