|
|
@@ -22,7 +22,9 @@ public protocol ServerSessionServerStreaming: ServerSession {
|
|
|
func waitForSendOperationsToFinish()
|
|
|
}
|
|
|
|
|
|
-open class ServerSessionServerStreamingBase<InputType: Message, OutputType: Message>: ServerSessionBase, ServerSessionServerStreaming {
|
|
|
+open class ServerSessionServerStreamingBase<InputType: Message, OutputType: Message>: ServerSessionBase, ServerSessionServerStreaming, StreamSending {
|
|
|
+ public typealias SentType = OutputType
|
|
|
+
|
|
|
public typealias ProviderBlock = (InputType, ServerSessionServerStreamingBase) throws -> Void
|
|
|
private var providerBlock: ProviderBlock
|
|
|
|
|
|
@@ -31,10 +33,6 @@ open class ServerSessionServerStreamingBase<InputType: Message, OutputType: Mess
|
|
|
super.init(handler: handler)
|
|
|
}
|
|
|
|
|
|
- public func send(_ response: OutputType, completion: ((Error?) -> Void)?) throws {
|
|
|
- try handler.sendResponse(message: response.serializedData(), completion: completion)
|
|
|
- }
|
|
|
-
|
|
|
public func run(queue: DispatchQueue) throws {
|
|
|
try handler.receiveMessage(initialMetadata: initialMetadata) { requestData in
|
|
|
// TODO(danielalm): Unify this behavior with `ServerSessionBidirectionalStreamingBase.run()`.
|
|
|
@@ -71,8 +69,8 @@ open class ServerSessionServerStreamingBase<InputType: Message, OutputType: Mess
|
|
|
open class ServerSessionServerStreamingTestStub<OutputType: Message>: ServerSessionTestStub, ServerSessionServerStreaming {
|
|
|
open var outputs: [OutputType] = []
|
|
|
|
|
|
- open func send(_ response: OutputType, completion _: ((Error?) -> Void)?) throws {
|
|
|
- outputs.append(response)
|
|
|
+ open func send(_ message: OutputType, completion _: @escaping (Error?) -> Void) throws {
|
|
|
+ outputs.append(message)
|
|
|
}
|
|
|
|
|
|
open func close() throws {}
|