Răsfoiți Sursa

Workaround for SR-11564 (#608)

Motivation:

gRPC Swift crashes when running any RPC on iOS when built with Xcode
11.2 beta (see issue: #605).

Modifications:

- Add methods `override`ing the `scheduleTimeout` method on the different
  client response channel handler subclasses. The overriden methods just
  explicitly call the method in the `super` class.

Result:

No crash on iOS when compiled with Xcode 11.2 beta.
George Barnett 6 ani în urmă
părinte
comite
af247f79c9
1 a modificat fișierele cu 16 adăugiri și 0 ștergeri
  1. 16 0
      Sources/GRPC/ClientResponseChannelHandler.swift

+ 16 - 0
Sources/GRPC/ClientResponseChannelHandler.swift

@@ -301,6 +301,14 @@ final class GRPCClientUnaryResponseChannelHandler<ResponseMessage: Message>: Cli
       self.responsePromise.fail(status)
     }
   }
+
+  // Workaround for SR-11564 (observed in Xcode 11.2 Beta).
+  // See: https://bugs.swift.org/browse/SR-11564
+  //
+  // TODO: Remove this once SR-11564 is resolved.
+  override internal func scheduleTimeout(eventLoop: EventLoop) {
+    super.scheduleTimeout(eventLoop: eventLoop)
+  }
 }
 
 /// A channel handler for client calls which receive a stream of responses.
@@ -340,6 +348,14 @@ final class GRPCClientStreamingResponseChannelHandler<ResponseMessage: Message>:
   override func onResponse(_ response: _Box<ResponseMessage>) {
     self.responseHandler(response.value)
   }
+
+  // Workaround for SR-11564 (observed in Xcode 11.2 Beta).
+  // See: https://bugs.swift.org/browse/SR-11564
+  //
+  // TODO: Remove this once SR-11564 is resolved.
+  override internal func scheduleTimeout(eventLoop: EventLoop) {
+    super.scheduleTimeout(eventLoop: eventLoop)
+  }
 }
 
 /// Client user events.