Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc0d3f1

Browse files
committed
pqWait() should check for exception status as well as read or write
ready. It appears that most (all?) Unixen will consider a socket tobe read or write ready if it has an error condition, but of courseMicrosoft does things differently.
1 parent8484f66 commitfc0d3f1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/interfaces/libpq/fe-misc.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*
2727
* IDENTIFICATION
28-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.47 2001/03/22 04:01:26 momjian Exp $
28+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.48 2001/03/31 23:13:30 tgl Exp $
2929
*
3030
*-------------------------------------------------------------------------
3131
*/
@@ -712,12 +712,17 @@ pqFlush(PGconn *conn)
712712

713713
/* --------------------------------------------------------------------- */
714714
/* pqWait: wait until we can read or write the connection socket
715+
*
716+
* We also stop waiting and return if the kernel flags an exception condition
717+
* on the socket. The actual error condition will be detected and reported
718+
* when the caller tries to read or write the socket.
715719
*/
716720
int
717721
pqWait(intforRead,intforWrite,PGconn*conn)
718722
{
719723
fd_setinput_mask;
720724
fd_setoutput_mask;
725+
fd_setexcept_mask;
721726

722727
if (conn->sock<0)
723728
{
@@ -731,17 +736,19 @@ pqWait(int forRead, int forWrite, PGconn *conn)
731736
retry:
732737
FD_ZERO(&input_mask);
733738
FD_ZERO(&output_mask);
739+
FD_ZERO(&except_mask);
734740
if (forRead)
735741
FD_SET(conn->sock,&input_mask);
736742
if (forWrite)
737743
FD_SET(conn->sock,&output_mask);
738-
if (select(conn->sock+1,&input_mask,&output_mask, (fd_set*)NULL,
744+
FD_SET(conn->sock,&except_mask);
745+
if (select(conn->sock+1,&input_mask,&output_mask,&except_mask,
739746
(structtimeval*)NULL)<0)
740747
{
741748
if (errno==EINTR)
742749
gotoretry;
743750
printfPQExpBuffer(&conn->errorMessage,
744-
"pqWait() -- select() failed: errno=%d\n%s\n",
751+
"pqWait() -- select() failed: errno=%d\n%s\n",
745752
errno,strerror(errno));
746753
returnEOF;
747754
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp