From 3f783a26b626386c2997d3ed1e884bf0cf1a7761 Mon Sep 17 00:00:00 2001 From: merge-script Date: Wed, 24 Apr 2024 19:14:48 +0800 Subject: [PATCH] Merge bitcoin/bitcoin#29882: netbase: clean up Proxy logging fb4cc5f423ce587c1e97377e8afdf92fb4850f59 netbase: clean up Proxy logging (Matthew Zipkin) Pull request description: Follow up to #27375 and see https://github.com/bitcoin/bitcoin/pull/29649#issuecomment-2057456834 This removes an extra log message when we can't connect to our own proxy, and another when the proxy is invalid. ## Before #27375 if proxy is unreachable ``` 2024-04-15T17:54:51Z connect() to 127.0.0.1:9999 failed after wait: Connection refused (61) 2024-04-15T17:54:52Z connect() to 127.0.0.1:9999 failed after wait: Connection refused (61) 2024-04-15T17:54:52Z connect() to 127.0.0.1:9999 failed after wait: Connection refused (61) 2024-04-15T17:54:53Z connect() to 127.0.0.1:9999 failed after wait: Connection refused (61) 2024-04-15T17:54:53Z connect() to 127.0.0.1:9999 failed after wait: Connection refused (61) ``` ## After #27375 if unix proxy is unreachable: ``` 2024-04-15T17:54:03Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T17:54:03Z Cannot connect to socket for /Users/matthewzipkin/Desktop/tor 2024-04-15T17:54:04Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T17:54:04Z Cannot connect to socket for /Users/matthewzipkin/Desktop/tor 2024-04-15T17:54:04Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T17:54:04Z Cannot connect to socket for /Users/matthewzipkin/Desktop/tor 2024-04-15T17:54:05Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T17:54:05Z Cannot connect to socket for /Users/matthewzipkin/Desktop/tor ``` ## After this PR: ``` 2024-04-15T18:18:51Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T18:18:51Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T18:18:52Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) 2024-04-15T18:18:52Z connect() to /Users/matthewzipkin/Desktop/tor failed: No such file or directory (2) ``` ACKs for top commit: tdb3: CR ACK for fb4cc5f423ce587c1e97377e8afdf92fb4850f59 laanwj: ACK fb4cc5f423ce587c1e97377e8afdf92fb4850f59 Tree-SHA512: f07b9f7f2ea9f4bc01780c09f0b076547108294a1fa7d158a0dd48d6d7351569e461e5cccf232b7b1413ce2e3679668e523e5a7c89cd58c909da76d3dcbc34de --- src/netbase.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/netbase.cpp b/src/netbase.cpp index 8bdd13d209d8..3aaf494525c0 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -639,10 +639,7 @@ std::unique_ptr ConnectDirectly(const CService& dest, bool manual_connecti std::unique_ptr Proxy::Connect() const { - if (!IsValid()) { - LogPrintf("Cannot connect to invalid Proxy\n"); - return {}; - } + if (!IsValid()) return {}; if (!m_is_unix_socket) return ConnectDirectly(proxy, /*manual_connection=*/true); @@ -663,7 +660,6 @@ std::unique_ptr Proxy::Connect() const socklen_t len = sizeof(addrun); if(!ConnectToSocket(*sock, (struct sockaddr*)&addrun, len, path, /*manual_connection=*/true)) { - LogPrintf("Cannot connect to socket for %s\n", path); return {}; }