From be1b9a718a09722e95ab04b08ccaf353dc3a51e9 Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Fri, 24 Jun 2016 13:22:11 -0700
Subject: [PATCH] Fixes

---
 src/core/lib/iomgr/error.c     | 5 ++++-
 src/core/lib/iomgr/tcp_posix.c | 4 ++--
 src/core/lib/surface/call.c    | 5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c
index 9f5ba76fd6..aa94bb7fdf 100644
--- a/src/core/lib/iomgr/error.c
+++ b/src/core/lib/iomgr/error.c
@@ -248,7 +248,10 @@ static grpc_error *copy_error_and_unref(grpc_error *in) {
   if (is_special(in)) {
     if (in == GRPC_ERROR_NONE) return GRPC_ERROR_CREATE("no error");
     if (in == GRPC_ERROR_OOM) return GRPC_ERROR_CREATE("oom");
-    if (in == GRPC_ERROR_CANCELLED) return GRPC_ERROR_CREATE("cancelled");
+    if (in == GRPC_ERROR_CANCELLED)
+      return grpc_error_set_int(GRPC_ERROR_CREATE("cancelled"),
+                                GRPC_ERROR_INT_GRPC_STATUS,
+                                GRPC_STATUS_CANCELLED);
     return GRPC_ERROR_CREATE("unknown");
   }
   grpc_error *out = gpr_malloc(sizeof(*out));
diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c
index 017f52c367..1046b60bcc 100644
--- a/src/core/lib/iomgr/tcp_posix.c
+++ b/src/core/lib/iomgr/tcp_posix.c
@@ -160,7 +160,7 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp,
                          grpc_error *error) {
   grpc_closure *cb = tcp->read_cb;
 
-  if (false && grpc_tcp_trace) {
+  if (grpc_tcp_trace) {
     size_t i;
     const char *str = grpc_error_string(error);
     gpr_log(GPR_DEBUG, "read: error=%s", str);
@@ -394,7 +394,7 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
   grpc_tcp *tcp = (grpc_tcp *)ep;
   grpc_error *error = GRPC_ERROR_NONE;
 
-  if (false && grpc_tcp_trace) {
+  if (grpc_tcp_trace) {
     size_t i;
 
     for (i = 0; i < buf->count; i++) {
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index 77c17a4975..708ea3502a 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -407,9 +407,10 @@ static void set_status_code(grpc_call *call, status_source source,
 static void set_status_details(grpc_call *call, status_source source,
                                grpc_mdstr *status) {
   if (call->status[source].details != NULL) {
-    GRPC_MDSTR_UNREF(call->status[source].details);
+    GRPC_MDSTR_UNREF(status);
+  } else {
+    call->status[source].details = status;
   }
-  call->status[source].details = status;
 }
 
 static void get_final_status(grpc_call *call,
-- 
GitLab