summaryrefslogtreecommitdiff
path: root/src/include/port.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/port.h')
-rw-r--r--src/include/port.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/include/port.h b/src/include/port.h
index 84bf2c363f5..d25716bf7f8 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -99,6 +99,28 @@ extern void pgfnames_cleanup(char **filenames);
)
#endif
+/*
+ * This macro provides a centralized list of all errnos that identify
+ * hard failure of a previously-established network connection.
+ * The macro is intended to be used in a switch statement, in the form
+ * "case ALL_CONNECTION_FAILURE_ERRNOS:".
+ *
+ * Note: this groups EPIPE and ECONNRESET, which we take to indicate a
+ * probable server crash, with other errors that indicate loss of network
+ * connectivity without proving much about the server's state. Places that
+ * are actually reporting errors typically single out EPIPE and ECONNRESET,
+ * while allowing the network failures to be reported generically.
+ */
+#define ALL_CONNECTION_FAILURE_ERRNOS \
+ EPIPE: \
+ case ECONNRESET: \
+ case ECONNABORTED: \
+ case EHOSTDOWN: \
+ case EHOSTUNREACH: \
+ case ENETDOWN: \
+ case ENETRESET: \
+ case ENETUNREACH
+
/* Portable locale initialization (in exec.c) */
extern void set_pglocale_pgservice(const char *argv0, const char *app);