Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit be94d8f

Browse files
committed
Keep Tcl from getting confused if backend closes connection
when a notify is installed.
1 parent 5d2cf6a commit be94d8f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/interfaces/libpgtcl/pgtclId.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 1994, Regents of the University of California
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.16 1998/09/21 01:02:03 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.17 1999/01/17 21:14:33 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -582,6 +582,15 @@ PgNotifyTransferEvents(Pg_ConnectionId * connid)
582582
Tcl_QueueEvent((Tcl_Event *) event, TCL_QUEUE_TAIL);
583583
free(notify);
584584
}
585+
586+
/*
587+
* This is also a good place to check for unexpected closure of the
588+
* connection (ie, backend crash), in which case we must shut down the
589+
* notify event source to keep Tcl from trying to select() on the now-
590+
* closed socket descriptor.
591+
*/
592+
if (PQsocket(connid->conn) < 0)
593+
PgStopNotifyEventSource(connid);
585594
}
586595

587596
/*

0 commit comments

Comments
 (0)