From 7ecc8a98341b802543fb4b2d9f498ce641bbd86c Mon Sep 17 00:00:00 2001 From: Stone Li Date: Wed, 15 Feb 2023 04:41:34 +0800 Subject: [PATCH] ENH: use a rare unfrequent port Change-Id: I29cd679c9d1e435170cbd091cd85a0973cca1012 Signed-off-by: Stone Li --- src/slic3r/GUI/HttpServer.cpp | 2 +- src/slic3r/GUI/HttpServer.hpp | 3 ++- src/slic3r/GUI/WebUserLoginDialog.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/HttpServer.cpp b/src/slic3r/GUI/HttpServer.cpp index 06d1c54760..1c2c27f1dd 100644 --- a/src/slic3r/GUI/HttpServer.cpp +++ b/src/slic3r/GUI/HttpServer.cpp @@ -130,7 +130,7 @@ void HttpServer::start() m_http_server_thread = Slic3r::create_thread( [this] { boost::asio::io_service io_service; - boost::asio::ip::tcp::endpoint endpoint{ boost::asio::ip::tcp::v4(), 9090}; + boost::asio::ip::tcp::endpoint endpoint{ boost::asio::ip::tcp::v4(), LOCALHOST_PORT}; boost::asio::ip::tcp::acceptor acceptor { io_service, endpoint}; acceptor.listen(); accept_and_run(acceptor, io_service); diff --git a/src/slic3r/GUI/HttpServer.hpp b/src/slic3r/GUI/HttpServer.hpp index 1d94bf879b..2a6a980ecc 100644 --- a/src/slic3r/GUI/HttpServer.hpp +++ b/src/slic3r/GUI/HttpServer.hpp @@ -16,7 +16,8 @@ using namespace boost; using namespace boost::system; using namespace boost::asio; -#define LOCALHOST_URL "http://localhost:9090" +#define LOCALHOST_PORT 13618 +#define LOCALHOST_URL "http://localhost:" namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index f482ad51ad..b0df7d5029 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -271,7 +271,7 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) CallAfter([this, sequence_id] { json ack_j; ack_j["command"] = "get_localhost_url"; - ack_j["response"]["base_url"] = LOCALHOST_URL; + ack_j["response"]["base_url"] = std::string(LOCALHOST_URL) + std::to_string(LOCALHOST_PORT); ack_j["response"]["result"] = "success"; ack_j["sequence_id"] = sequence_id; wxString str_js = wxString::Format("window.postMessage(%s)", ack_j.dump());