diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-01-17 21:14:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-01-17 21:14:33 +0000 |
commit | be94d8fb1e38503c1f44b38810fdae8493bdfb17 (patch) | |
tree | f8b1a7e7c6396245cc81f0d675a2e55232d8550e | |
parent | 5d2cf6af9ea7312b75defb254dfcdf206ca6cd34 (diff) | |
download | postgresql-be94d8fb1e38503c1f44b38810fdae8493bdfb17.tar.gz postgresql-be94d8fb1e38503c1f44b38810fdae8493bdfb17.zip |
Keep Tcl from getting confused if backend closes connection
when a notify is installed.
-rw-r--r-- | src/interfaces/libpgtcl/pgtclId.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/interfaces/libpgtcl/pgtclId.c b/src/interfaces/libpgtcl/pgtclId.c index 602147db1c2..8f333eae9ab 100644 --- a/src/interfaces/libpgtcl/pgtclId.c +++ b/src/interfaces/libpgtcl/pgtclId.c @@ -12,7 +12,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.16 1998/09/21 01:02:03 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.17 1999/01/17 21:14:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -582,6 +582,15 @@ PgNotifyTransferEvents(Pg_ConnectionId * connid) Tcl_QueueEvent((Tcl_Event *) event, TCL_QUEUE_TAIL); free(notify); } + + /* + * This is also a good place to check for unexpected closure of the + * connection (ie, backend crash), in which case we must shut down the + * notify event source to keep Tcl from trying to select() on the now- + * closed socket descriptor. + */ + if (PQsocket(connid->conn) < 0) + PgStopNotifyEventSource(connid); } /* |