@@ -3,28 +3,31 @@ import OpenClawKit
33import OSLog
44
55struct MacNodeGatewayTLSSessionCache {
6- private typealias Key = (
7- url: URL ,
8- required: Bool ,
9- expectedFingerprint: String ? ,
10- allowTOFU: Bool ,
11- storeKey: String ? )
6+ private struct Key : Equatable {
7+ let url : URL
8+ let required : Bool
9+ let expectedFingerprint : String ?
10+ let allowTOFU : Bool
11+ let storeKey : String ?
12+
13+ init ( url: URL , params: GatewayTLSParams ) {
14+ self . url = url
15+ self . required = params. required
16+ self . expectedFingerprint = params. expectedFingerprint
17+ self . allowTOFU = params. allowTOFU
18+ self . storeKey = params. storeKey
19+ }
20+ }
1221
1322 private var cachedKey : Key ?
1423 private var cachedBox : WebSocketSessionBox ?
1524
16- // GatewayNodeSession treats session identity changes as reconnect input.
1725 mutating func sessionBox( url: URL , params: GatewayTLSParams ? ) -> WebSocketSessionBox ? {
1826 guard let params else {
1927 self . invalidate ( )
2028 return nil
2129 }
22- let key = (
23- url: url,
24- required: params. required,
25- expectedFingerprint: params. expectedFingerprint,
26- allowTOFU: params. allowTOFU,
27- storeKey: params. storeKey)
30+ let key = Key ( url: url, params: params)
2831 if let cachedKey = self . cachedKey, cachedKey == key, let cachedBox = self . cachedBox {
2932 return cachedBox
3033 }
0 commit comments