qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Ottlik <ottlik@fzi.de>
To: qemu-devel@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Sebastian Ottlik <ottlik@fzi.de>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v4 2/5] gdbstub: call socket_set_fast_reuse instead of setting SO_REUSEADDR
Date: Mon, 16 Sep 2013 10:25:04 +0200	[thread overview]
Message-ID: <1379319907-14950-3-git-send-email-ottlik@fzi.de> (raw)
In-Reply-To: <1379319907-14950-1-git-send-email-ottlik@fzi.de>

SO_REUSEADDR should be avoided on Windows but is desired on other operating
systems. So instead of setting it we call socket_set_fast_reuse that will result
in the appropriate behaviour on all operating systems.

Signed-off-by: Sebastian Ottlik <ottlik@fzi.de>
---
 gdbstub.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 2b7f22b..f43291a 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1553,7 +1553,7 @@ static void gdb_accept(void)
 static int gdbserver_open(int port)
 {
     struct sockaddr_in sockaddr;
-    int fd, val, ret;
+    int fd, ret;
 
     fd = socket(PF_INET, SOCK_STREAM, 0);
     if (fd < 0) {
@@ -1564,9 +1564,7 @@ static int gdbserver_open(int port)
     fcntl(fd, F_SETFD, FD_CLOEXEC);
 #endif
 
-    /* allow fast reuse */
-    val = 1;
-    qemu_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+    socket_set_fast_reuse(fd, false);
 
     sockaddr.sin_family = AF_INET;
     sockaddr.sin_port = htons(port);
-- 
1.7.9.5

  parent reply	other threads:[~2013-09-16  8:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16  8:25 [Qemu-devel] [PATCH v4 0/5] Do not set SO_REUSEADDR on Windows Sebastian Ottlik
2013-09-16  8:25 ` [Qemu-devel] [PATCH v4 1/5] util: add socket_set_fast_reuse function which will replace setting SO_REUSEADDR Sebastian Ottlik
2013-09-16  8:25 ` Sebastian Ottlik [this message]
2013-09-16 14:03   ` [Qemu-devel] [PATCH v4 2/5] gdbstub: call socket_set_fast_reuse instead of " Eric Blake
2013-09-16 14:07     ` Sebastian Ottlik
2013-09-16  8:25 ` [Qemu-devel] [PATCH v4 3/5] net: " Sebastian Ottlik
2013-09-16 14:04   ` Eric Blake
2013-09-16  8:25 ` [Qemu-devel] [PATCH v4 4/5] slirp: " Sebastian Ottlik
2013-09-16  8:25 ` [Qemu-devel] [PATCH v4 5/5] util: " Sebastian Ottlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379319907-14950-3-git-send-email-ottlik@fzi.de \
    --to=ottlik@fzi.de \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).