Skip to content

Commit 497d39d

Browse files
committed
prevent multiplexing Windows kernel event objects we listen for across various sockets - should fix the occasional stats test regression failures we see.
1 parent 6dd2b77 commit 497d39d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/port/win32/socket.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.11 2006/03/05 15:58:35 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.12 2006/07/29 19:55:18 adunstan Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -106,6 +106,7 @@ int
106106
pgwin32_waitforsinglesocket(SOCKET s, int what)
107107
{
108108
static HANDLE waitevent = INVALID_HANDLE_VALUE;
109+
static SOCKET current_socket = -1;
109110
HANDLE events[2];
110111
int r;
111112

@@ -121,6 +122,15 @@ pgwin32_waitforsinglesocket(SOCKET s, int what)
121122
ereport(ERROR,
122123
(errmsg_internal("Failed to reset socket waiting event: %i", (int) GetLastError())));
123124

125+
/*
126+
* make sure we don't multiplex this kernel event object with a different
127+
* socket from a previous call
128+
*/
129+
130+
if (current_socket != s && current_socket != -1)
131+
WSAEventSelect(current_socket, waitevent, 0);
132+
133+
current_socket = s;
124134

125135
if (WSAEventSelect(s, waitevent, what) == SOCKET_ERROR)
126136
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy