File tree Expand file tree Collapse file tree
Sources/OpenClaw/NodeMode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,7 @@ struct MacNodeGatewayTLSSessionCache {
2222 private var cachedKey : Key ?
2323 private var cachedBox : WebSocketSessionBox ?
2424
25- mutating func sessionBox( url: URL , params: GatewayTLSParams ? ) -> WebSocketSessionBox ? {
26- guard let params else {
27- self . invalidate ( )
28- return nil
29- }
25+ mutating func sessionBox( url: URL , params: GatewayTLSParams ) -> WebSocketSessionBox {
3026 let key = Key ( url: url, params: params)
3127 if let cachedKey = self . cachedKey, cachedKey == key, let cachedBox = self . cachedBox {
3228 return cachedBox
@@ -316,11 +312,15 @@ final class MacNodeModeCoordinator {
316312 }
317313 let stableID = Self . tlsPinStoreKey ( for: url)
318314 let stored = GatewayTLSStore . loadFingerprint ( stableID: stableID)
319- let params = Self . tlsParams (
315+ guard let params = Self . tlsParams (
320316 for: url,
321317 connectionMode: connectionMode,
322318 root: OpenClawConfigFile . loadDict ( ) ,
323319 storedFingerprint: stored)
320+ else {
321+ self . tlsSessionCache. invalidate ( )
322+ return nil
323+ }
324324 return self . tlsSessionCache. sessionBox ( url: url, params: params)
325325 }
326326}
Original file line number Diff line number Diff line change @@ -98,8 +98,8 @@ struct MacNodeModeCoordinatorTests {
9898 root: [ " gateway " : [ " remote " : [ " tlsFingerprint " : " sha256:configured " ] ] ] ,
9999 storedFingerprint: " stored " ) )
100100
101- let first = try #require ( cache. sessionBox ( url: url, params: params) )
102- let second = try #require ( cache. sessionBox ( url: url, params: params) )
101+ let first = cache. sessionBox ( url: url, params: params)
102+ let second = cache. sessionBox ( url: url, params: params)
103103
104104 #expect( ObjectIdentifier ( first. session) == ObjectIdentifier ( second. session) )
105105 }
@@ -118,8 +118,8 @@ struct MacNodeModeCoordinatorTests {
118118 root: [ " gateway " : [ " remote " : [ " tlsFingerprint " : " sha256:rotated " ] ] ] ,
119119 storedFingerprint: " stored " ) )
120120
121- let first = try #require ( cache. sessionBox ( url: url, params: firstParams) )
122- let second = try #require ( cache. sessionBox ( url: url, params: secondParams) )
121+ let first = cache. sessionBox ( url: url, params: firstParams)
122+ let second = cache. sessionBox ( url: url, params: secondParams)
123123
124124 #expect( ObjectIdentifier ( first. session) != ObjectIdentifier ( second. session) )
125125 }
You can’t perform that action at this time.
0 commit comments