@@ -73,6 +73,18 @@ void P2PoolManager::download() {
7373 #endif
7474 QFile file (fileName);
7575 epee::net_utils::http::http_simple_client http_client;
76+ QString proxyAddress;
77+ {
78+ QMutexLocker locker (&m_proxyMutex);
79+ proxyAddress = m_proxyAddress;
80+ }
81+
82+ if (!proxyAddress.isEmpty () && !http_client.set_proxy (proxyAddress.toStdString ())) {
83+ qCritical () << " Failed to set p2pool download proxy address" << proxyAddress;
84+ emit p2poolDownloadFailure (ConnectionIssue);
85+ return ;
86+ }
87+
7688 const epee::net_utils::http::http_response_info* response = NULL ;
7789 std::string userAgent = randomUserAgent ().toStdString ();
7890 std::chrono::milliseconds timeout = std::chrono::seconds (10 );
@@ -196,6 +208,15 @@ bool P2PoolManager::start(const QString &flags, const QString &address, const QS
196208 arguments << " --wallet" << address;
197209 }
198210
211+ {
212+ QMutexLocker locker (&m_proxyMutex);
213+ if (!m_proxyAddress.isEmpty ()) {
214+ if (!arguments.contains (" --socks5" )) {
215+ arguments << " --socks5" << m_proxyAddress;
216+ }
217+ }
218+ }
219+
199220 qDebug () << " starting p2pool " + m_p2pool;
200221 qDebug () << " With command line arguments " << arguments;
201222
@@ -220,6 +241,25 @@ bool P2PoolManager::start(const QString &flags, const QString &address, const QS
220241 return true ;
221242}
222243
244+ QString P2PoolManager::proxyAddress () const
245+ {
246+ QMutexLocker locker (&m_proxyMutex);
247+ return m_proxyAddress;
248+ }
249+
250+ void P2PoolManager::setProxyAddress (QString address)
251+ {
252+ {
253+ QMutexLocker locker (&m_proxyMutex);
254+ if (m_proxyAddress == address) {
255+ return ;
256+ }
257+ m_proxyAddress = address;
258+ }
259+
260+ emit proxyAddressChanged ();
261+ }
262+
223263void P2PoolManager::exit ()
224264{
225265 qDebug (" P2PoolManager: exit()" );
0 commit comments