From 0f8953fc1dc8f5a50fb47c9e734b660abc53f101 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 28 May 2025 19:55:01 +0000 Subject: [PATCH] fix(test/server): Fix force cleanup in DNS server tests by casting server properties before closing sockets --- changelog.md | 6 ++++++ test/test.server.ts | 8 ++++---- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 44eefc3..bb84ae7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-05-28 - 7.4.1 - fix(test/server) +Fix force cleanup in DNS server tests by casting server properties before closing sockets + +- Cast server to any to safely invoke close() on httpsServer and udpServer in test cleanup +- Ensures proper emergency cleanup of server sockets without direct access to private properties + ## 2025-05-28 - 7.4.0 - feat(manual socket handling) Add comprehensive manual socket handling documentation for advanced DNS server use cases diff --git a/test/test.server.ts b/test/test.server.ts index 9b958b2..515ae45 100644 --- a/test/test.server.ts +++ b/test/test.server.ts @@ -193,13 +193,13 @@ async function stopServer(server: smartdns.DnsServer | null | undefined) { try { // @ts-ignore - accessing private properties for emergency cleanup if (server.httpsServer) { - server.httpsServer.close(); - server.httpsServer = null; + (server as any).httpsServer.close(); + (server as any).httpsServer = null; } // @ts-ignore - accessing private properties for emergency cleanup if (server.udpServer) { - server.udpServer.close(); - server.udpServer = null; + (server as any).udpServer.close(); + (server as any).udpServer = null; } } catch (forceError) { console.log('Force cleanup error:', forceError.message || forceError); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 03ea310..f47cf63 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartdns', - version: '7.4.0', + version: '7.4.1', description: 'A robust TypeScript library providing advanced DNS management and resolution capabilities including support for DNSSEC, custom DNS servers, and integration with various DNS providers.' }