Просмотр исходного кода

Only schedule a close if the ping was actually sent (#1626)

Co-authored-by: George Barnett <gbarnett@apple.com>
Marcel Hasselaar 2 лет назад
Родитель
Сommit
bf34fdd318
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      Sources/GRPC/GRPCIdleHandler.swift

+ 3 - 1
Sources/GRPC/GRPCIdleHandler.swift

@@ -265,7 +265,9 @@ internal final class GRPCIdleHandler: ChannelInboundHandler {
       initialDelay: delay,
       delay: delay
     ) { _ in
-      self.handlePingAction(self.pingHandler.pingFired())
+      let action = self.pingHandler.pingFired()
+      if case .none = action { return }
+      self.handlePingAction(action)
       // `timeout` is less than `interval`, guaranteeing that the close task
       // will be fired before a new ping is triggered.
       assert(timeout < delay, "`timeout` must be less than `interval`")