From 1b1a86028c21dddc42a9debb38fc8314661fe5f5 Mon Sep 17 00:00:00 2001
From: Ken Payson <kpayson@google.com>
Date: Mon, 14 Nov 2016 10:10:47 -0800
Subject: [PATCH] Return status unavailable (over internal) on EPIPE

---
 src/core/lib/iomgr/tcp_posix.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c
index 880af93ee1..6a13c7be51 100644
--- a/src/core/lib/iomgr/tcp_posix.c
+++ b/src/core/lib/iomgr/tcp_posix.c
@@ -380,6 +380,11 @@ static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
         tcp->outgoing_slice_idx = unwind_slice_idx;
         tcp->outgoing_byte_idx = unwind_byte_idx;
         return false;
+      } else if (errno == EPIPE) {
+        *error = grpc_error_set_int(GRPC_OS_ERROR(errno, "sendmsg"),
+                                    GRPC_ERROR_INT_GRPC_STATUS,
+                                    GRPC_STATUS_UNAVAILABLE);
+        return true;
       } else {
         *error = GRPC_OS_ERROR(errno, "sendmsg");
         return true;
-- 
GitLab