Browse Source

Rename some things.

Jon Shier 2 years ago
parent
commit
445efb7a10
2 changed files with 8 additions and 9 deletions
  1. 8 8
      Source/Request.swift
  2. 0 1
      Tests/ConcurrencyTests.swift

+ 8 - 8
Source/Request.swift

@@ -1804,7 +1804,7 @@ public final class WebSocketRequest: Request {
 
 
     @discardableResult
     @discardableResult
     public func close(sending closeCode: URLSessionWebSocketTask.CloseCode, reason: Data? = nil) -> Self {
     public func close(sending closeCode: URLSessionWebSocketTask.CloseCode, reason: Data? = nil) -> Self {
-        cancelTimedPing()
+        cancelAutomaticPing()
 
 
         mutableState.write { mutableState in
         mutableState.write { mutableState in
             guard mutableState.state.canTransitionTo(.cancelled) else { return }
             guard mutableState.state.canTransitionTo(.cancelled) else { return }
@@ -1830,7 +1830,7 @@ public final class WebSocketRequest: Request {
 
 
     @discardableResult
     @discardableResult
     override public func cancel() -> Self {
     override public func cancel() -> Self {
-        cancelTimedPing()
+        cancelAutomaticPing()
 
 
         return super.cancel()
         return super.cancel()
     }
     }
@@ -1847,7 +1847,7 @@ public final class WebSocketRequest: Request {
         }
         }
 
 
         if let pingInterval = pingInterval {
         if let pingInterval = pingInterval {
-            startTimedPing(onInterval: pingInterval)
+            startAutomaticPing(onInterval: pingInterval)
         }
         }
     }
     }
 
 
@@ -1878,10 +1878,10 @@ public final class WebSocketRequest: Request {
         }
         }
     }
     }
 
 
-    func startTimedPing(onInterval pingInterval: TimeInterval) {
+    func startAutomaticPing(onInterval pingInterval: TimeInterval) {
         socketMutableState.write { mutableState in
         socketMutableState.write { mutableState in
             guard isResumed else {
             guard isResumed else {
-                defer { cancelTimedPing() }
+                defer { cancelAutomaticPing() }
                 return
                 return
             }
             }
 
 
@@ -1891,7 +1891,7 @@ public final class WebSocketRequest: Request {
                 self.sendPing(respondingOn: self.underlyingQueue) { response in
                 self.sendPing(respondingOn: self.underlyingQueue) { response in
                     guard case .pong = response else { return }
                     guard case .pong = response else { return }
 
 
-                    self.startTimedPing(onInterval: pingInterval)
+                    self.startAutomaticPing(onInterval: pingInterval)
                 }
                 }
             }
             }
 
 
@@ -1900,7 +1900,7 @@ public final class WebSocketRequest: Request {
         }
         }
     }
     }
 
 
-    func cancelTimedPing() {
+    func cancelAutomaticPing() {
         socketMutableState.write { mutableState in
         socketMutableState.write { mutableState in
             mutableState.pingTimerItem?.cancel()
             mutableState.pingTimerItem?.cancel()
             mutableState.pingTimerItem = nil
             mutableState.pingTimerItem = nil
@@ -1910,7 +1910,7 @@ public final class WebSocketRequest: Request {
     func didDisconnect(closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) {
     func didDisconnect(closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) {
         dispatchPrecondition(condition: .onQueue(underlyingQueue))
         dispatchPrecondition(condition: .onQueue(underlyingQueue))
 
 
-        cancelTimedPing()
+        cancelAutomaticPing()
         socketMutableState.read { state in
         socketMutableState.read { state in
             state.handlers.forEach { handler in
             state.handlers.forEach { handler in
                 // Saved handler calls out to serializationQueue immediately, then to handler's queue.
                 // Saved handler calls out to serializationQueue immediately, then to handler's queue.

+ 0 - 1
Tests/ConcurrencyTests.swift

@@ -776,7 +776,6 @@ final class WebSocketConcurrencyTests: BaseTestCase {
         XCTAssertTrue(messages.count == 1)
         XCTAssertTrue(messages.count == 1)
     }
     }
 }
 }
-
 #endif
 #endif
 
 
 @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)