diff options
author | Eric Wild <ewild@sysmocom.de> | 2019-06-21 15:26:25 +0200 |
---|---|---|
committer | Hoernchen <ewild@sysmocom.de> | 2019-06-21 15:24:41 +0000 |
commit | 6eb186c0972118537df577bcec9b094d8b373adc (patch) | |
tree | 82fca63088be5b15b9394384684a5a700c777ecc | |
parent | b8242720b8c36bcac7e89ef46861662c2c3dd099 (diff) |
add TCP_USER_TIMEOUT to keepalive
The patch sets TCP_USER_TIMEOUT to the same timeout value,
since keepalive only applies to idle connections, but we obviously want
to fail as fast as possible even if there is data to send and it's not
acked.
Change-Id: I5e7425958472aa5d758e09bfbefc7d7d37bf6f5f
-rw-r--r-- | src/input/ipaccess.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index d0fa023..fb6ad10 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -459,6 +459,17 @@ static void update_fd_settings(struct e1inp_line *line, int fd) LOGP(DLINP, LOGL_NOTICE, "Failed to set keepalive count: %s\n", strerror(errno)); +#if defined(TCP_USER_TIMEOUT) + val = 1000 * line->keepalive_num_probes * + line->keepalive_probe_interval + + line->keepalive_idle_timeout; + ret = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, + &val, sizeof(val)); + if (ret < 0) + LOGP(DLINP, LOGL_NOTICE, + "Failed to set user timoeut: %s\n", + strerror(errno)); +#endif #endif } } |