Browse Source

Consolidate a few more calls into `StreamSending`.

Daniel Alm 7 years ago
parent
commit
9916aeaa36

+ 0 - 9
Sources/SwiftGRPC/Runtime/ClientCallBidirectionalStreaming.swift

@@ -36,11 +36,6 @@ open class ClientCallBidirectionalStreamingBase<InputType: Message, OutputType:
     return self
   }
 
-  public func send(_ message: InputType, completion: @escaping (Error?) -> Void) throws {
-    let messageData = try message.serializedData()
-    try call.sendMessage(data: messageData, completion: completion)
-  }
-
   public func closeSend(completion: (() -> Void)?) throws {
     try call.close(completion: completion)
   }
@@ -52,10 +47,6 @@ open class ClientCallBidirectionalStreamingBase<InputType: Message, OutputType:
     }
     _ = sem.wait()
   }
-  
-  public func waitForSendOperationsToFinish() {
-    call.messageQueueEmpty.wait()
-  }
 }
 
 /// Simple fake implementation of ClientCallBidirectionalStreamingBase that returns a previously-defined set of results

+ 0 - 4
Sources/SwiftGRPC/Runtime/ClientCallClientStreaming.swift

@@ -60,10 +60,6 @@ open class ClientCallClientStreamingBase<InputType: Message, OutputType: Message
     case .error(let error): throw error
     }
   }
-
-  public func waitForSendOperationsToFinish() {
-    call.messageQueueEmpty.wait()
-  }
 }
 
 /// Simple fake implementation of ClientCallClientStreamingBase that

+ 0 - 4
Sources/SwiftGRPC/Runtime/ServerSessionBidirectionalStreaming.swift

@@ -53,10 +53,6 @@ open class ServerSessionBidirectionalStreamingBase<InputType: Message, OutputTyp
       }
     }
   }
-
-  public func waitForSendOperationsToFinish() {
-    handler.call.messageQueueEmpty.wait()
-  }
 }
 
 /// Simple fake implementation of ServerSessionBidirectionalStreaming that returns a previously-defined set of results

+ 0 - 4
Sources/SwiftGRPC/Runtime/ServerSessionServerStreaming.swift

@@ -58,10 +58,6 @@ open class ServerSessionServerStreamingBase<InputType: Message, OutputType: Mess
       }
     }
   }
-
-  public func waitForSendOperationsToFinish() {
-    handler.call.messageQueueEmpty.wait()
-  }
 }
 
 /// Simple fake implementation of ServerSessionServerStreaming that returns a previously-defined set of results

+ 4 - 0
Sources/SwiftGRPC/Runtime/StreamSending.swift

@@ -28,4 +28,8 @@ extension StreamSending {
   public func send(_ message: SentType, completion: @escaping (Error?) -> Void) throws {
     try call.sendMessage(data: message.serializedData(), completion: completion)
   }
+  
+  public func waitForSendOperationsToFinish() {
+    call.messageQueueEmpty.wait()
+  }
 }