From 55ee8212dc4c96aba6020ecd1855414b45038b08 Mon Sep 17 00:00:00 2001 From: Nova Date: Fri, 28 Feb 2025 16:51:44 +0330 Subject: [PATCH] add timeout for api calls --- core/server/internal/boxdns/dns_manager_windows.go | 2 -- src/api/gRPC.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/core/server/internal/boxdns/dns_manager_windows.go b/core/server/internal/boxdns/dns_manager_windows.go index e03761f..89a271f 100644 --- a/core/server/internal/boxdns/dns_manager_windows.go +++ b/core/server/internal/boxdns/dns_manager_windows.go @@ -11,7 +11,6 @@ import ( "nekobox_core/internal/boxdns/winipcfg" "net/netip" "strings" - "time" ) const ( @@ -24,7 +23,6 @@ var dnsIsSet bool func HandleInterfaceChange(_ *control.Interface, _ int) { monitorForUnderlyingDNS() - time.Sleep(2 * time.Second) if !dnsIsSet { return } diff --git a/src/api/gRPC.cpp b/src/api/gRPC.cpp index d7bf37a..c20e40b 100644 --- a/src/api/gRPC.cpp +++ b/src/api/gRPC.cpp @@ -145,7 +145,7 @@ namespace QtGrpc { QNetworkReply::NetworkError Call(const QString &methodName, const google::protobuf::Message &req, google::protobuf::Message *rsp, - int timeout_ms = 0) { + int timeout_ms = 2000) { if (!NekoGui::dataStore->core_running) return QNetworkReply::NetworkError(-1919); std::string reqStr;