[libvirt] [PATCH 03/10] Check status when attempting to set SO_REUSEADDR flag on outgoing connection On failure, VIR_WARN(), but continue to connect.
John Ferlan
jferlan at redhat.com
Thu Jan 3 19:57:19 UTC 2013
On 01/03/2013 02:34 PM, Daniel P. Berrange wrote:
> On Thu, Jan 03, 2013 at 02:16:15PM -0500, John Ferlan wrote:
>> ---
>> 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 ef93892..6684eef 100644
>> --- a/src/rpc/virnetsocket.c
>> +++ b/src/rpc/virnetsocket.c
>> @@ -470,7 +470,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;
>
> Hmm, not sure I agree with this. If this is something that should
> not occurr, then we should virReportError. If it is something we
> expect to occur, then VIR_WARN will annoy people with irrelevant
> messages.
I asked about this yesterday and Michal P responded. The REUSEADDR is a
more of a hint for connections, see the end of:
https://www.redhat.com/archives/libvir-list/2013-January/msg00064.html
I don't mind either way.
>
> My inclination is to treat it as a fatal error
>
> Daniel
>
More information about the libvir-list
mailing list