diff options
Diffstat (limited to 'src/backend/port/win32/socket.c')
-rw-r--r-- | src/backend/port/win32/socket.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c index 76dd6be9a63..dbbd4a35d16 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -14,7 +14,8 @@ #include "postgres.h" /* - * Indicate if pgwin32_recv() should operate in non-blocking mode. + * Indicate if pgwin32_recv() and pgwin32_send() should operate + * in non-blocking mode. * * Since the socket emulation layer always sets the actual socket to * non-blocking mode in order to be able to deliver signals, we must @@ -399,6 +400,16 @@ pgwin32_send(SOCKET s, char *buf, int len, int flags) return -1; } + if (pgwin32_noblock) + { + /* + * No data sent, and we are in "emulated non-blocking mode", so + * return indicating that we'd block if we were to continue. + */ + errno = EWOULDBLOCK; + return -1; + } + /* No error, zero bytes (win2000+) or error+WSAEWOULDBLOCK (<=nt4) */ if (pgwin32_waitforsinglesocket(s, FD_WRITE | FD_CLOSE, INFINITE) == 0) |