Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Tom Lane
Magnus Hagander <[EMAIL PROTECTED]> writes: > On Thu, Mar 08, 2007 at 10:37:11AM -0500, Tom Lane wrote: >> Because the calls in DllMain covered us (ie, the WSA usage count never >> got to be less than one). If we remove them, we'd better get this pair >> right. > But those calls weren't even comp

Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Magnus Hagander
On Thu, Mar 08, 2007 at 10:37:11AM -0500, Tom Lane wrote: > Magnus Hagander <[EMAIL PROTECTED]> writes: > > On Thu, Mar 08, 2007 at 10:10:28AM -0500, Tom Lane wrote: > >> Also, isn't the WSACleanup() in freePGconn in the wrong place? Seems > >> like it shouldn't be done until after we've closed th

Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Tom Lane
Magnus Hagander <[EMAIL PROTECTED]> writes: > On Thu, Mar 08, 2007 at 10:10:28AM -0500, Tom Lane wrote: >> Also, isn't the WSACleanup() in freePGconn in the wrong place? Seems >> like it shouldn't be done until after we've closed the socket. I'd >> be inclined to put it at the bottom of the routi

Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Magnus Hagander
On Thu, Mar 08, 2007 at 10:10:28AM -0500, Tom Lane wrote: > Magnus Hagander <[EMAIL PROTECTED]> writes: > > So I suggest the following simple patch.. Any objections? > > One wonders if we need DllMain() at all any more. We certainly don't > need that switch statement ... Indeed. Looking even mor

Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Tom Lane
Magnus Hagander <[EMAIL PROTECTED]> writes: > So I suggest the following simple patch.. Any objections? One wonders if we need DllMain() at all any more. We certainly don't need that switch statement ... Also, isn't the WSACleanup() in freePGconn in the wrong place? Seems like it shouldn't be d

Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Magnus Hagander
On Thu, Mar 08, 2007 at 12:47:42PM +0100, Andreas Pflug wrote: > Magnus Hagander wrote: > > > > The easy fix for this is to remove the calls. Which obviously will break > > some client apps. A fairly easy fix for the WSAStartup() call is to have > > a check in the connection functions against a glo

Re: [HACKERS] WSAStartup() in libpq

2007-03-08 Thread Andreas Pflug
Magnus Hagander wrote: > > The easy fix for this is to remove the calls. Which obviously will break > some client apps. A fairly easy fix for the WSAStartup() call is to have > a check in the connection functions against a global variable that will > then make sure to call WSAStartup() the first ti