fix(routing): serialize route updates and correct VPN-gated route application
This commit is contained in:
@@ -267,7 +267,18 @@ export class VpnManager {
|
||||
doc.vlanId = opts.vlanId;
|
||||
}
|
||||
this.clients.set(doc.clientId, doc);
|
||||
await this.persistClient(doc);
|
||||
try {
|
||||
await this.persistClient(doc);
|
||||
} catch (err) {
|
||||
// Rollback: remove from in-memory map and daemon to stay consistent with DB
|
||||
this.clients.delete(doc.clientId);
|
||||
try {
|
||||
await this.vpnServer!.removeClient(doc.clientId);
|
||||
} catch {
|
||||
// best-effort daemon cleanup
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
// Sync per-client security to the running daemon
|
||||
const security = this.buildClientSecurity(doc);
|
||||
|
||||
Reference in New Issue
Block a user