qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 4/5] slirp: call socket_set_fast_reuse instea


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 4/5] slirp: call socket_set_fast_reuse instead of setting SO_REUSEADDR
Date: Tue, 10 Sep 2013 09:58:46 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/10/2013 07:26 AM, Sebastian Ottlik wrote:
> 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 <address@hidden>
> ---
>  slirp/misc.c     |    3 +--
>  slirp/socket.c   |    4 +---
>  slirp/tcp_subr.c |    6 ++----
>  slirp/udp.c      |    4 ++--
>  4 files changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/slirp/misc.c b/slirp/misc.c
> index c0d4899..6c1636f 100644
> --- a/slirp/misc.c
> +++ b/slirp/misc.c
> @@ -212,8 +212,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
>                      so->s = accept(s, (struct sockaddr *)&addr, &addrlen);
>                  } while (so->s < 0 && errno == EINTR);
>                  closesocket(s);
> -                opt = 1;
> -                qemu_setsockopt(so->s, SOL_SOCKET, SO_REUSEADDR, &opt, 
> sizeof(int));
> +                socket_set_fast_reuse(so->s);

Here's a case where the old code didn't care about failure, but the code
in 1/5 results in a message via perror().  If that is intentional, it's
best to mention it in the commit message.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]