Commit 63393bdf authored by Tom Lane's avatar Tom Lane

Produce a more specific error message when backend sees EOF on

client connection.
parent 31cce21f
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pqcomm.c,v 1.66 1999/02/13 23:15:46 momjian Exp $ * $Id: pqcomm.c,v 1.67 1999/02/18 01:13:26 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -229,7 +229,7 @@ pq_recvbuf() ...@@ -229,7 +229,7 @@ pq_recvbuf()
{ {
int r = recv(MyProcPort->sock, PqRecvBuffer + PqRecvLength, int r = recv(MyProcPort->sock, PqRecvBuffer + PqRecvLength,
PQ_BUFFER_SIZE - PqRecvLength, 0); PQ_BUFFER_SIZE - PqRecvLength, 0);
if (r <= 0) if (r < 0)
{ {
if (errno == EINTR) if (errno == EINTR)
continue; /* Ok if interrupted */ continue; /* Ok if interrupted */
...@@ -238,7 +238,13 @@ pq_recvbuf() ...@@ -238,7 +238,13 @@ pq_recvbuf()
* if we have a hard communications failure ... * if we have a hard communications failure ...
* So just write the message to the postmaster log. * So just write the message to the postmaster log.
*/ */
fprintf(stderr, "pq_recvbuf: recv() failed, errno %d\n", errno); fprintf(stderr, "pq_recvbuf: recv() failed, errno=%d\n", errno);
return EOF;
}
if (r == 0)
{
/* as above, elog not safe */
fprintf(stderr, "pq_recvbuf: unexpected EOF on client connection\n");
return EOF; return EOF;
} }
/* r contains number of bytes read, so just incr length */ /* r contains number of bytes read, so just incr length */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment