From 891ad5ad2524b1ca3ca4890546f27bcff7fdf57a Mon Sep 17 00:00:00 2001 From: Krystie Date: Sat, 25 Apr 2026 14:15:15 -0700 Subject: [PATCH] Merge bootstrap improvements --- src/bootstrap.cpp | 7 +++++-- src/bootstrap.h | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp index 7a16db7..20569ce 100644 --- a/src/bootstrap.cpp +++ b/src/bootstrap.cpp @@ -208,12 +208,13 @@ bool DownloadFile(const std::string& host, const std::string& urlPath, const fs::path& destPath, ProgressCallback progressFn, std::string& strError, - bool noProxy) + bool noProxy, + int portOverride) { try { std::string currentHost = host; std::string currentPath = urlPath; - int currentPort = PORT; + int currentPort = (portOverride > 0) ? portOverride : PORT; bool useSSL = false; std::string headerData; int redirectCount = 0; @@ -675,7 +676,9 @@ bool DownloadBootstrap(const std::string& host, fs::path tmpTarGz = dataDir / "bootstrap.tar.gz.tmp"; std::string tarUrl = std::string(BASE_PATH) + "triangles-bootstrap.tar.gz"; + printf("DownloadBootstrap(): attempting tar.gz download from %s%s\n", host.c_str(), tarUrl.c_str()); bool tarDownloaded = DownloadFile(host, tarUrl, tmpTarGz, progressFn, strError, noProxy); + printf("DownloadBootstrap(): tarDownloaded=%d result=%s\n", tarDownloaded, strError.c_str()); if (tarDownloaded) { bool extractOk = ExtractTarGz(tmpTarGz, dataDir, strError); diff --git a/src/bootstrap.h b/src/bootstrap.h index 0b69bba..116d5a4 100644 --- a/src/bootstrap.h +++ b/src/bootstrap.h @@ -25,11 +25,13 @@ namespace Bootstrap { // Download a single file via HTTP GET, write to destPath. // If noProxy is true, bypass Tor SOCKS proxy and connect directly // (used for clearnet bootstrap downloads). + // If portOverride is set (>0), uses that port instead of the default PORT. bool DownloadFile(const std::string& host, const std::string& urlPath, const boost::filesystem::path& destPath, ProgressCallback progressFn, std::string& strError, - bool noProxy = false); + bool noProxy = false, + int portOverride = -1); // Fetch the file manifest (list of relative paths to download) bool FetchFileList(const std::string& host,