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
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 @@
 			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
 	}
 }