Assert(PqCommReadingMsg) in pq_peekbyte().
authorNoah Misch <[email protected]>
Sat, 7 Feb 2015 04:14:27 +0000 (23:14 -0500)
committerNoah Misch <[email protected]>
Sat, 7 Feb 2015 04:14:27 +0000 (23:14 -0500)
Interrupting pq_recvbuf() can break protocol sync, so its callers all
deserve this assertion.  The one pq_peekbyte() caller suffices already.

src/backend/libpq/pqcomm.c

index 0d97aa45fbc63ed7aa7c5b6ace4098b842bbb123..09dea4bbe165d921c904fb0087a2193205756a9e 100644 (file)
@@ -928,6 +928,8 @@ pq_getbyte(void)
 int
 pq_peekbyte(void)
 {
+   Assert(PqCommReadingMsg);
+
    while (PqRecvPointer >= PqRecvLength)
    {
        if (pq_recvbuf())       /* If nothing in buffer, then recv some */