diff --git a/core/server/gen/libcore.proto b/core/server/gen/libcore.proto index 4b74cba..fe242d3 100644 --- a/core/server/gen/libcore.proto +++ b/core/server/gen/libcore.proto @@ -5,8 +5,6 @@ option go_package = "grpc_server/gen"; option optimize_for = LITE_RUNTIME; service LibcoreService { - rpc Exit(EmptyReq) returns (EmptyResp); - // rpc Start(LoadConfigReq) returns (ErrorResp); rpc Stop(EmptyReq) returns (ErrorResp); rpc CheckConfig(LoadConfigReq) returns (ErrorResp); diff --git a/core/server/server.go b/core/server/server.go index 3eaa452..e1c21cb 100644 --- a/core/server/server.go +++ b/core/server/server.go @@ -40,22 +40,6 @@ func To[T any](v T) *T { return &v } -func (s *server) Exit(ctx context.Context, in *gen.EmptyReq) (out *gen.EmptyResp, _ error) { - out = &gen.EmptyResp{} - - if needUnsetDNS { - needUnsetDNS = false - err := sys.SetSystemDNS("Empty", boxInstance.Network().InterfaceMonitor()) - if err != nil { - log.Println("Failed to unset system DNS:", err) - } - } - - // Connection closed - defer os.Exit(0) - return -} - func (s *server) Start(ctx context.Context, in *gen.LoadConfigReq) (out *gen.ErrorResp, _ error) { var err error diff --git a/include/api/gRPC.h b/include/api/gRPC.h index b79445a..043a85b 100644 --- a/include/api/gRPC.h +++ b/include/api/gRPC.h @@ -16,8 +16,6 @@ namespace API { public: explicit Client(std::function onError, const QString &target); - void Exit(); - // QString returns is error string QString Start(bool *rpcOK, const libcore::LoadConfigReq &request); diff --git a/src/api/gRPC.cpp b/src/api/gRPC.cpp index 23b5def..8791ce2 100644 --- a/src/api/gRPC.cpp +++ b/src/api/gRPC.cpp @@ -188,13 +188,6 @@ namespace API { *rpcOK = false; \ onError(QString("QNetworkReply::NetworkError code: %1\n").arg(status)); - void Client::Exit() { - libcore::EmptyReq request; - libcore::EmptyResp reply; - std::vector rsp; - default_grpc_channel->Call("Exit", spb::pb::serialize< std::string >( request ), rsp, 100); - } - QString Client::Start(bool *rpcOK, const libcore::LoadConfigReq &request) { libcore::ErrorResp reply; std::vector rsp; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 11f28a4..731a031 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -843,7 +843,7 @@ void MainWindow::prepare_exit() Configs::dataStore->save_control_no_save = true; // don't change datastore after this line profile_stop(false, true); sem_stopped.acquire(); - API::defaultClient->Exit(); + core_process->Kill(); mu_exit.unlock(); qDebug() << "prepare exit done!"; }