mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Error out if waiting on socket readiness without a specified socket.
Previously we just ignored such an attempt, but that seems to serve no purpose but making things harder to debug. Discussion: 20160114143931.GG10941@awork2.anarazel.de 20151230173734.hx7jj2fnwyljfqek@alap3.anarazel.de Reviewed-By: Robert Haas
This commit is contained in:
@ -226,12 +226,13 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
|
|||||||
int hifd;
|
int hifd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Ignore WL_SOCKET_* events if no valid socket is given */
|
|
||||||
if (sock == PGINVALID_SOCKET)
|
|
||||||
wakeEvents &= ~(WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE);
|
|
||||||
|
|
||||||
Assert(wakeEvents != 0); /* must have at least one wake event */
|
Assert(wakeEvents != 0); /* must have at least one wake event */
|
||||||
|
|
||||||
|
/* waiting for socket readiness without a socket indicates a bug */
|
||||||
|
if (sock == PGINVALID_SOCKET &&
|
||||||
|
(wakeEvents & (WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE)) != 0)
|
||||||
|
elog(ERROR, "cannot wait on socket event without a socket");
|
||||||
|
|
||||||
if ((wakeEvents & WL_LATCH_SET) && latch->owner_pid != MyProcPid)
|
if ((wakeEvents & WL_LATCH_SET) && latch->owner_pid != MyProcPid)
|
||||||
elog(ERROR, "cannot wait on a latch owned by another process");
|
elog(ERROR, "cannot wait on a latch owned by another process");
|
||||||
|
|
||||||
|
@ -113,12 +113,13 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
int pmdeath_eventno = 0;
|
int pmdeath_eventno = 0;
|
||||||
|
|
||||||
/* Ignore WL_SOCKET_* events if no valid socket is given */
|
|
||||||
if (sock == PGINVALID_SOCKET)
|
|
||||||
wakeEvents &= ~(WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE);
|
|
||||||
|
|
||||||
Assert(wakeEvents != 0); /* must have at least one wake event */
|
Assert(wakeEvents != 0); /* must have at least one wake event */
|
||||||
|
|
||||||
|
/* waiting for socket readiness without a socket indicates a bug */
|
||||||
|
if (sock == PGINVALID_SOCKET &&
|
||||||
|
(wakeEvents & (WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE)) != 0)
|
||||||
|
elog(ERROR, "cannot wait on socket event without a socket");
|
||||||
|
|
||||||
if ((wakeEvents & WL_LATCH_SET) && latch->owner_pid != MyProcPid)
|
if ((wakeEvents & WL_LATCH_SET) && latch->owner_pid != MyProcPid)
|
||||||
elog(ERROR, "cannot wait on a latch owned by another process");
|
elog(ERROR, "cannot wait on a latch owned by another process");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user