On Tue, Jul 1, 2014 at 10:58 AM, Gurucharan Shetty <shet...@nicira.com> wrote:
> On Mon, Jun 30, 2014 at 10:20 AM, Ben Pfaff <b...@nicira.com> wrote:
>> On Mon, Jun 30, 2014 at 10:13:54AM -0700, Gurucharan Shetty wrote:
>>> On Thu, Jun 26, 2014 at 1:26 PM, Ben Pfaff <b...@nicira.com> wrote:
>>> > On Tue, Jun 24, 2014 at 11:52:54AM -0700, Gurucharan Shetty wrote:
>>> >> On Windows ECONNRESET is WSAECONNRESET.
>>> >>
>>> >> Also, "unix" connections are done through TCP sockets.
>>> >> For the 'refuse-connection' test, the error message for Windows
>>> >> is WSAECONNRESET instead of EPIPE.
>>> >>
>>> >> Signed-off-by: Gurucharan Shetty <gshe...@nicira.com>
>>> >
>>> > I'm a little confused about why Windows has error codes like ECONNRESET
>>> > if it never uses them.  Is there any reason not to add something like
>>> Currently, Windows has kept errno.h constants separate from winsock2
>>> error constants. The WinSock error values are the BSD error values
>>> with a "WinSock API base" error (WSABASEERR) value added to each of
>>> them.
>>>
>>> http://msdn.microsoft.com/en-us/library/windows/desktop/ms737828(v=vs.85).aspx
>>>
>>> Though one can possibly do as you suggest below (apparently it was the
>>> default a few years ago), Microsoft now recommends against doing it
>>> for possible conflicts. In case of ECONNRESET, there is probably no
>>> issues in doing what you suggest.
>>
>> Hmm.
>>
>> Here is another possibility.  We have this sock_errno() function that
>> all checks for socket errnos must go through.  Can it detect that the
>> value is a WSA* and subtract WSABASEERR to transform it into a standard
>> error code?
> I was wrong when I previously said "The WinSock error values are the
> BSD error values with a "WinSock API base" error (WSABASEERR) value
> added to each of them."
> So, the above solution wouldn't work. I only realized it after
> implementing the above suggestion. I misunderstood the intent of
> WSABASEERR while reading the header file.
>
> So the question is should we handle the case of ECONNRESET as a
> one-off thing and handle it separately like you suggested. i.e.,
> #if _WIN32
> #undef ECONNRESET
> #define ECONNRESET WSAECONNRESET
> #endif

I'm in favor of whichever solution you think is easier to maintain over time.
I don't have a strong opinion either way.
-- 
"I don't normally do acked-by's.  I think it's my way of avoiding
getting blamed when it all blows up."               Andrew Morton
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to