Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn
Date
Msg-id 19850.1372340905@sss.pgh.pa.us
Whole thread Raw
In response to Re: PQConnectPoll, connect(2), EWOULDBLOCK and somaxconn  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-06-26 20:07:40 -0400, Tom Lane wrote:
>> However, some more trolling of the intertubes suggests that Cygwin's
>> emulation of socket() does indeed return EINPROGRESS; see for instance
>> this ancient thread of ours:
>>
http://www.postgresql.org/message-id/flat/14855.49635.565990.716645@kryten.bedford.waii.com#14855.49635.565990.716645@kryten.bedford.waii.com
>> Unless we want to distinguish Cygwin from native Windows in this code
>> chunk, maybe we'd better leave well enough alone.

> After some looking it gets funnier. There currently doesn't seem to be
> any chance that we actually can get an EINPROGRESS at that level on
> windows. We #define connect() to pgwin32_connect() which fudges errno
> around. Where WSAEINPROGRESS is mapped to EINVAL.

That's only in the backend though: note the #define is controlled by
#ifndef FRONTEND, and we don't link backend/port/win32/socket.c into
libpq anyway.  The signal managing it's doing wouldn't work at all in
client-side programs.

But yeah, on the backend side we would definitely treat WSAEINPROGRESS
as a hard error.  OTOH, we don't use nonblocking connect (much?) in the
backend so I'm not sure whether that's a directly comparable case or
not.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Min value for port
Next
From: Robert Haas
Date:
Subject: Re: Move unused buffers to freelist