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

Commit6bc4d95

Browse files
committed
Error out if waiting on socket readiness without a specified socket.
Previously we just ignored such an attempt, but that seems to serve nopurpose but making things harder to debug.Discussion: 20160114143931.GG10941@awork2.anarazel.de 20151230173734.hx7jj2fnwyljfqek@alap3.anarazel.deReviewed-By: Robert Haas
1 parentfad0f9d commit6bc4d95

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

‎src/backend/port/unix_latch.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,13 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
226226
inthifd;
227227
#endif
228228

229-
/* Ignore WL_SOCKET_* events if no valid socket is given */
230-
if (sock==PGINVALID_SOCKET)
231-
wakeEvents &= ~(WL_SOCKET_READABLE |WL_SOCKET_WRITEABLE);
232-
233229
Assert(wakeEvents!=0);/* must have at least one wake event */
234230

231+
/* waiting for socket readiness without a socket indicates a bug */
232+
if (sock==PGINVALID_SOCKET&&
233+
(wakeEvents& (WL_SOCKET_READABLE |WL_SOCKET_WRITEABLE))!=0)
234+
elog(ERROR,"cannot wait on socket event without a socket");
235+
235236
if ((wakeEvents&WL_LATCH_SET)&&latch->owner_pid!=MyProcPid)
236237
elog(ERROR,"cannot wait on a latch owned by another process");
237238

‎src/backend/port/win32_latch.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,13 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
113113
intresult=0;
114114
intpmdeath_eventno=0;
115115

116-
/* Ignore WL_SOCKET_* events if no valid socket is given */
117-
if (sock==PGINVALID_SOCKET)
118-
wakeEvents &= ~(WL_SOCKET_READABLE |WL_SOCKET_WRITEABLE);
119-
120116
Assert(wakeEvents!=0);/* must have at least one wake event */
121117

118+
/* waiting for socket readiness without a socket indicates a bug */
119+
if (sock==PGINVALID_SOCKET&&
120+
(wakeEvents& (WL_SOCKET_READABLE |WL_SOCKET_WRITEABLE))!=0)
121+
elog(ERROR,"cannot wait on socket event without a socket");
122+
122123
if ((wakeEvents&WL_LATCH_SET)&&latch->owner_pid!=MyProcPid)
123124
elog(ERROR,"cannot wait on a latch owned by another process");
124125

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp