1313 *
1414 *Copyright (c) 2001-2003, PostgreSQL Global Development Group
1515 *
16- *$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.60 2004/03/10 21:12:46 momjian Exp $
16+ *$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.61 2004/03/15 16: 21:37 momjian Exp $
1717 * ----------
1818 */
1919#include "postgres.h"
@@ -1642,6 +1642,7 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
16421642 */
16431643int nread = 0 ;
16441644int targetlen = sizeof (PgStat_MsgHdr );/* initial */
1645+ bool pipeEOF = false;
16451646
16461647while (nread < targetlen )
16471648{
@@ -1652,13 +1653,23 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
16521653{
16531654if (errno == EINTR )
16541655continue ;
1656+ #ifdef WIN32
1657+ if (WSAGetLastError ()== WSAECONNRESET )/* EOF on the pipe! (win32 socket based implementation) */
1658+ {
1659+ pipeEOF = true;
1660+ break ;
1661+ }
1662+ #endif
16551663ereport (LOG ,
16561664(errcode_for_socket_access (),
1657- errmsg ("could not read from statistics collector pipe: %m" )));
1665+ errmsg ("could not read from statistics collector pipe: %m" )));
16581666exit (1 );
16591667}
16601668if (len == 0 )/* EOF on the pipe! */
1669+ {
1670+ pipeEOF = true;
16611671break ;
1672+ }
16621673nread += len ;
16631674if (nread == sizeof (PgStat_MsgHdr ))
16641675{
@@ -1683,7 +1694,7 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
16831694 * EOF on the pipe implies that the buffer process exited.
16841695 * Fall out of outer loop.
16851696 */
1686- if (len == 0 )
1697+ if (pipeEOF )
16871698break ;
16881699
16891700/*