fix policy

This commit is contained in:
anlicheng 2026-05-19 23:14:06 +08:00
parent 3ab82a13b5
commit 082fb1547e
4 changed files with 20 additions and 5 deletions

View File

@ -261,7 +261,7 @@ extension SDLContextActor {
await self.handleEvent(event: event)
case .policyReponse(let policyResponse):
//
await self.policyService.identifyStore.applyPolicyResponse(policyResponse)
await self.policyService.applyPolicyResponse(policyResponse)
case .arpResponse(let arpResponse):
SDLLogger.log("[SDLContext] get arp response: \(arpResponse)")
await self.arpServer.handleArpResponse(arpResponse: arpResponse)

View File

@ -101,10 +101,8 @@ extension SDLTunPacketRouter.RouteDecision {
switch self {
case .forwardToNextHop(_, _, _, let kind):
switch kind {
case .sameNetwork, .exitNode:
case .sameNetwork, .exitNode, .dnsExitNode:
return true
case .dnsExitNode:
return false
}
default:
return false

View File

@ -81,6 +81,13 @@ actor IdentityStore {
publisher.publish(snapshot)
}
func clear() {
self.coolingDown.removeAll()
self.versions.removeAll()
self.identityMap.removeAll()
self.publisher.publish(IdentitySnapshot.empty())
}
private func compileSnapshot() -> IdentitySnapshot {
return IdentitySnapshot(identityMap: identityMap)
}

View File

@ -69,8 +69,18 @@ actor PolicyService {
}
}
func clear() {
func applyPolicyResponse(_ policyResponse: SDLPolicyResponse) async {
guard policyResponse.dstIdentityID == self.identityId else {
SDLLogger.log("[PolicyService] ignore policy response, dstIdentityID mismatch: \(policyResponse.dstIdentityID), expected: \(self.identityId)", for: .debug)
return
}
await self.identifyStore.applyPolicyResponse(policyResponse)
}
func clear() async {
self.flowSessionManager.clear()
await self.identifyStore.clear()
}
deinit {