Skip to content

Commit 5eca6cf

Browse files
committed
shm_mq: Repair breakage from previous commit.
If the counterparty writes some data into the queue and then detaches, it's wrong to return SHM_MQ_DETACHED right away. If we do that, we fail to read whatever was written.
1 parent 87abcb4 commit 5eca6cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/storage/ipc/shm_mq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,12 @@ shm_mq_receive(shm_mq_handle *mqh, Size *nbytesp, void **datap, bool nowait)
405405
{
406406
if (nowait)
407407
{
408-
if (shm_mq_counterparty_gone(mq, mqh->mqh_handle))
409-
return SHM_MQ_DETACHED;
410408
if (shm_mq_get_sender(mq) == NULL)
409+
{
410+
if (shm_mq_counterparty_gone(mq, mqh->mqh_handle))
411+
return SHM_MQ_DETACHED;
411412
return SHM_MQ_WOULD_BLOCK;
413+
}
412414
}
413415
else if (!shm_mq_wait_internal(mq, &mq->mq_sender, mqh->mqh_handle)
414416
&& shm_mq_get_sender(mq) == NULL)

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