]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Use TCP_NODELAY (and SO_KEEPALIVE) as suggested by Frank Ch. Eigler. jankratochvil/gdbserver
authorJan Kratochvil <jan.kratochvil@redhat.com>
Fri, 7 Jan 2011 14:24:46 +0000 (15:24 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Fri, 7 Jan 2011 14:24:46 +0000 (15:24 +0100)
src/gdbserver.c

index 2986506bc22ca862e2763b603cb7127b423c4ba4..9b9e862574d620600fc1d5d53f6f24821f17db14 100644 (file)
@@ -45,6 +45,7 @@
 #include <fcntl.h>
 #include <stdarg.h>
 #include <sys/param.h>
+#include <netinet/tcp.h>
 
 /* FIXME: regs should use GDB XML arch descriptor instead!  */
 #include <sys/user.h>
@@ -139,6 +140,14 @@ open_socket (const char *ports)
   if (i != 0)
     error (EXIT_FAILURE, errno, gettext ("Could not close the port"));
 
+  i = 1;
+  /* Errors ignored.  */
+  setsockopt (sock2, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof (i));
+
+  i = 1;
+  /* Errors ignored.  */
+  setsockopt (sock2, IPPROTO_TCP, TCP_NODELAY, &i, sizeof (i));
+
   return sock2;
 }