Re: [BUGS] WIN32 Non Blocking
Here is the email I received that made me apply the Win32 libpq patch. I
asked him to send me a diff showing exactly what he wants added. By
committing to CVS, perhaps he can diff against the current cvs tree.
----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Darko Prenosil" <darko_prenosil@yahoo.com>
Cc: <pgsql-bugs@postgresql.org>
Sent: Tuesday, July 17, 2001 2:51 PM
Subject: Re: [BUGS] WIN32 Non BlockingI just got a new Win32 libpq patch. Please see it at:
http://candle.pha.pa.us/cgi-bin/pgpatches
How does your match with that one? I haven't applied it yet.
Hi Bruce!
First I'm sorry for being lazy and not giving You the answer when You asked.
I did take a look at the patch that Dmitry Yurtaev posted.
He's code is looking better than my in getting error information, I only
forced it to work.
Dmitry also corrected problem with "EWOULDBLOCK" status, so you can skip
this too in my code.
So if You accept Dmitry's code only one more thing should be done
to make non-blocking connections:Correct the PQconnectPoll function, because WINSOCK getsockopt
function must be called in different way under WIN32 !Here is code :
/*
* Now check (using getsockopt) that there is not an error
* state waiting for us on the socket.
*/
#ifndef WIN32
int optval;
ACCEPT_TYPE_ARG3 optlen = sizeof(optval);if (getsockopt(conn->sock, SOL_SOCKET, SO_ERROR,
(char *) &optval, &optlen) == -1){
printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- getsockopt() failed: "
"errno=%d\n%s\n",
errno, strerror(errno));
goto error_return;
}
else if (optval != 0)
{/*
* When using a nonblocking connect, we will typically
* see connect failures at this point, so provide a
* friendly error message.
*/
connectFailureMessage(conn, "PQconnectPoll()", optval);
goto error_return;
}
#else
char far optval[8];
ACCEPT_TYPE_ARG3 optlen = sizeof(optval);int OptResult=getsockopt(conn->sock, SOL_SOCKET, SO_ERROR,optval,
&optlen);
if (OptResult==SOCKET_ERROR){
printfPQExpBuffer(&conn->errorMessage,
"PQconnectPoll() -- getsockopt() failed: "
"errno=%i\n",
WSAGetLastError());
connectFailureMessage(conn, "PQconnectPoll()", OptResult);
goto error_return;
}
#endif...................Or something like that
Documentation on getsockopt function I found in MSDN, if you need it , I'll
send it to You.I'm new in Linux world, so please forgive me that I made diff that shows
irrelevant code changes like
spaces between comments.Darko Prenosil
Darko.Prenosil@finteh.hr_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Import Notes
Reply to msg id not found: 001d01c1108b$3b546610$1700a8c0@darko
----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Darko Prenosil" <darko_prenosil@yahoo.com>
Cc: "PostgreSQL-Committers" <pgsql-committers@postgreSQL.org>
Sent: Friday, July 20, 2001 11:25 PM
Subject: Re: [BUGS] WIN32 Non BlockingHere is the email I received that made me apply the Win32 libpq patch. I
asked him to send me a diff showing exactly what he wants added. By
committing to CVS, perhaps he can diff against the current cvs tree.I'll try to make the changes against current version of CVS and then test it
and send the diff.
You will hear from me soon.
Darko.Prenosil@Finteh.hr
Yes, I thought if I applied the patch you could look at it and apply
your changes easily.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Import Notes
Reply to msg id not found: 002e01c11179$6f6660e0$1700a8c0@darko | Resolved by subject fallback