diff options
author | Heikki Linnakangas | 2011-12-09 09:37:21 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2011-12-09 12:21:36 +0000 |
commit | 5d8a894e3095b2f602e901c19689f3176bf20543 (patch) | |
tree | b917c7012c64edb02883ac4e3a2ed59368cbc06e /src/include/miscadmin.h | |
parent | d5f23af6bfbc454e86dd16e5c7a0bfc0cf6189d0 (diff) |
Cancel running query if it is detected that the connection to the client is
lost. The only way we detect that at the moment is when write() fails when
we try to write to the socket.
Florian Pflug with small changes by me, reviewed by Greg Jaskiewicz.
Diffstat (limited to 'src/include/miscadmin.h')
-rw-r--r-- | src/include/miscadmin.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 4ee08fead6f..1df7723d995 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -55,6 +55,11 @@ * course, only if the interrupt holdoff counter is zero). See the * related code for details. * + * A lost connection is handled similarly, although the loss of connection + * does not raise a signal, but is detected when we fail to write to the + * socket. If there was a signal for a broken connection, we could make use of + * it by setting ClientConnectionLost in the signal handler. + * * A related, but conceptually distinct, mechanism is the "critical section" * mechanism. A critical section not only holds off cancel/die interrupts, * but causes any ereport(ERROR) or ereport(FATAL) to become ereport(PANIC) @@ -70,6 +75,8 @@ extern PGDLLIMPORT volatile bool InterruptPending; extern volatile bool QueryCancelPending; extern volatile bool ProcDiePending; +extern volatile bool ClientConnectionLost; + /* these are marked volatile because they are examined by signal handlers: */ extern volatile bool ImmediateInterruptOK; extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount; |