diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-03-30 10:10:32 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-03-30 10:20:37 +0300 |
commit | 754baa21f723255272c24dc5f9ab456858e361e3 (patch) | |
tree | fb2b3c4abb71fd3d0786f3b67c931820b386cf7f /src/backend/port/win32/socket.c | |
parent | bc03c5937d103952ef4f40a3fa4514c154538d25 (diff) | |
download | postgresql-754baa21f723255272c24dc5f9ab456858e361e3.tar.gz postgresql-754baa21f723255272c24dc5f9ab456858e361e3.zip |
Automatically terminate replication connections that are idle for more
than replication_timeout (a new GUC) milliseconds. The TCP timeout is often
too long, you want the master to notice a dead connection much sooner.
People complained about that in 9.0 too, but with synchronous replication
it's even more important to notice dead connections promptly.
Fujii Masao and Heikki Linnakangas
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) |