Re: [PATCH v2 1/4] rpc: Check and message setsockopt()

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

 



On 01/15/2013 07:12 PM, John Ferlan wrote:
> Check status when attempting to set SO_REUSEADDR flag on outgoing connection
> On failure, VIR_WARN(), but continue to connect. This code path is on the
> sender side where the setting is just a hint and would only take effect if
> the sender is overflowed with TCP connections.  Inability to set doesn't mean
> failure to establish a connection.
> ---
>  src/rpc/virnetsocket.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
> index c31d383..aa523c0 100644
> --- a/src/rpc/virnetsocket.c
> +++ b/src/rpc/virnetsocket.c
> @@ -472,7 +472,9 @@ int virNetSocketNewConnectTCP(const char *nodename,
>              goto error;
>          }
>  
> -        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
> +        if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
> +            VIR_WARN("Unable to enable port reuse");
> +        }
>  
>          if (connect(fd, runp->ai_addr, runp->ai_addrlen) >= 0)
>              break;
> 

ACK && Pushed,

Martin

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]