qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 3/5] net: call socket_set_fast_reuse instead


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v4 3/5] net: call socket_set_fast_reuse instead of setting SO_REUSEADDR
Date: Mon, 16 Sep 2013 08:04:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/16/2013 02:25 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.
> 
> An exception to this rule are multicast sockets where it is sensible to have
> multiple sockets listen on the same ip and port and we should set SO_REUSEADDR
> on windows.
> 

>      /* allow fast reuse */
> -    val = 1;
> -    qemu_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
> +    socket_set_fast_reuse(fd, false);

Changed from silent to noisy.  Intentional?

> @@ -661,11 +665,9 @@ static int net_socket_udp_init(NetClientState *peer,
>          perror("socket(PF_INET, SOCK_DGRAM)");
>          return -1;
>      }
> -    val = 1;
> -    ret = qemu_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
> -                          &val, sizeof(val));
> +
> +    ret = socket_set_fast_reuse(fd, true);
>      if (ret < 0) {
> -        perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
>          closesocket(fd);
>          return -1;

Changed from noisy to silent.  Intentional?

-- 
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]