summary refs log tree commit diff stats
path: root/slirp/tcp_subr.c
diff options
context:
space:
mode:
authorSebastian Ottlik <ottlik@fzi.de>2013-10-02 12:23:15 +0200
committerStefan Weil <sw@weilnetz.de>2013-10-02 19:20:31 +0200
commitaad1239a7e15f42c0b8a802433582c48417a4541 (patch)
treefee4e67adf710c1972d16546aecf9fe6b914dccd /slirp/tcp_subr.c
parentbcbe92fb080420551125994f3b15c139019da694 (diff)
downloadfocaccia-qemu-aad1239a7e15f42c0b8a802433582c48417a4541.tar.gz
focaccia-qemu-aad1239a7e15f42c0b8a802433582c48417a4541.zip
slirp: call socket_set_fast_reuse instead of setting SO_REUSEADDR
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>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Diffstat (limited to 'slirp/tcp_subr.c')
-rw-r--r--slirp/tcp_subr.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 043f28fcae..7571c5a282 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -337,8 +337,7 @@ int tcp_fconnect(struct socket *so)
     struct sockaddr_in addr;
 
     qemu_set_nonblock(s);
-    opt = 1;
-    qemu_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+    socket_set_fast_reuse(s);
     opt = 1;
     qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt));
 
@@ -426,8 +425,7 @@ void tcp_connect(struct socket *inso)
         return;
     }
     qemu_set_nonblock(s);
-    opt = 1;
-    qemu_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(int));
+    socket_set_fast_reuse(s);
     opt = 1;
     qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
     socket_set_nodelay(s);