From 402ccc173bff4a1f2a3a396d501781ae563faa6d Mon Sep 17 00:00:00 2001 From: pionere Date: Sun, 19 Nov 2023 18:14:01 +0100 Subject: [PATCH] cleanup protocol_zt - get rid of current_ms - implement and call zerotier_network_stop in the destructor --- Source/dvlnet/protocol_zt.cpp | 7 ++----- Source/dvlnet/protocol_zt.h | 1 - Source/dvlnet/zerotier_native.cpp | 5 +++++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/dvlnet/protocol_zt.cpp b/Source/dvlnet/protocol_zt.cpp index 4ab1edfe113..6da58aaad81 100644 --- a/Source/dvlnet/protocol_zt.cpp +++ b/Source/dvlnet/protocol_zt.cpp @@ -289,6 +289,8 @@ void protocol_zt::close_all() protocol_zt::~protocol_zt() { close_all(); + + zerotier_network_stop(); } void protocol_zt::endpoint::from_string(const std::string& str) @@ -311,11 +313,6 @@ void protocol_zt::endpoint::to_addr(unsigned char* dest_addr) const memcpy(dest_addr, addr.data(), sizeof(addr)); } -uint64_t protocol_zt::current_ms() -{ - return 0; -} - void protocol_zt::make_default_gamename(char (&gamename)[NET_MAX_GAMENAME_LEN + 1]) { int i; diff --git a/Source/dvlnet/protocol_zt.h b/Source/dvlnet/protocol_zt.h index 8b4912bbee8..5a4809eb82b 100644 --- a/Source/dvlnet/protocol_zt.h +++ b/Source/dvlnet/protocol_zt.h @@ -73,7 +73,6 @@ class protocol_zt { int fd_tcp = -1; int fd_udp = -1; - static uint64_t current_ms(); void close_all(); static void set_nonblock(int fd); diff --git a/Source/dvlnet/zerotier_native.cpp b/Source/dvlnet/zerotier_native.cpp index fea4520139a..c4206fda5a6 100644 --- a/Source/dvlnet/zerotier_native.cpp +++ b/Source/dvlnet/zerotier_native.cpp @@ -64,6 +64,11 @@ void zerotier_network_start() zts_node_start(); } +void zerotier_network_stop() +{ + zts_node_stop(); +} + } // namespace net DEVILUTION_END_NAMESPACE #endif // ZEROTIER