浏览代码

Send status on client for streaming calls

SebastianThiebaud 7 年之前
父节点
当前提交
953b21805b
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      Sources/gRPC/Call.swift

+ 8 - 6
Sources/gRPC/Call.swift

@@ -219,11 +219,11 @@ public class Call {
       }
       operations = [
         .sendInitialMetadata(metadata.copy()),
+        .sendMessage(ByteBuffer(data:message)),
+        .sendCloseFromClient,
         .receiveInitialMetadata,
+        .receiveMessage,
         .receiveStatusOnClient,
-        .sendMessage(ByteBuffer(data: message)),
-        .sendCloseFromClient,
-        .receiveMessage
       ]
     case .serverStreaming:
       guard let message = message else {
@@ -231,14 +231,16 @@ public class Call {
       }
       operations = [
         .sendInitialMetadata(metadata.copy()),
+        .sendMessage(ByteBuffer(data:message)),
+        .sendCloseFromClient,
         .receiveInitialMetadata,
-        .sendMessage(ByteBuffer(data: message)),
-        .sendCloseFromClient
+        .receiveStatusOnClient,
       ]
     case .clientStreaming, .bidiStreaming:
       operations = [
         .sendInitialMetadata(metadata.copy()),
-        .receiveInitialMetadata
+        .receiveInitialMetadata,
+        .receiveStatusOnClient,
       ]
     }
     try perform(OperationGroup(call: self,