*
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.60 2004/03/10 21:12:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.61 2004/03/15 16:21:37 momjian Exp $
* ----------
*/
#include "postgres.h"
*/
int nread = 0;
int targetlen = sizeof(PgStat_MsgHdr); /* initial */
+ bool pipeEOF = false;
while (nread < targetlen)
{
{
if (errno == EINTR)
continue;
+#ifdef WIN32
+ if (WSAGetLastError() == WSAECONNRESET) /* EOF on the pipe! (win32 socket based implementation) */
+ {
+ pipeEOF = true;
+ break;
+ }
+#endif
ereport(LOG,
(errcode_for_socket_access(),
- errmsg("could not read from statistics collector pipe: %m")));
+ errmsg("could not read from statistics collector pipe: %m")));
exit(1);
}
if (len == 0) /* EOF on the pipe! */
+ {
+ pipeEOF = true;
break;
+ }
nread += len;
if (nread == sizeof(PgStat_MsgHdr))
{
* EOF on the pipe implies that the buffer process exited.
* Fall out of outer loop.
*/
- if (len == 0)
+ if (pipeEOF)
break;
/*