merge default tip
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 07 Jun 2021 11:21:26 +0200
changeset 17 e319814f1c17
parent 16 4f584251c73d (current diff)
parent 12 16ea5cbbda4e (diff)
merge
--- a/mb_tcp.c	Sun Jun 06 22:52:40 2021 +0100
+++ b/mb_tcp.c	Mon Jun 07 11:21:26 2021 +0200
@@ -467,6 +467,18 @@
   }
 
   /* configure the socket */
+  {
+   int optval;
+   socklen_t optlen = sizeof(optval);
+   optval = 1;
+   if(setsockopt(socket_id, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) {
+#ifdef ERRMSG
+    perror("setsockopt()");
+    fprintf(stderr, ERRMSG_HEAD "Error configuring socket 'KeepAlive' option.\n");
+#endif
+      return -1;
+   }
+  }
     /* set the TCP no delay flag. */
   {int bool_opt = 1;
   if (setsockopt(socket_id, SOL_TCP, TCP_NODELAY,