aboutsummaryrefslogtreecommitdiff
path: root/src/i2p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/i2p.cpp')
-rw-r--r--src/i2p.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/i2p.cpp b/src/i2p.cpp
index 02f2c1cea2..962adb124d 100644
--- a/src/i2p.cpp
+++ b/src/i2p.cpp
@@ -115,7 +115,7 @@ static CNetAddr DestB64ToAddr(const std::string& dest)
namespace sam {
Session::Session(const fs::path& private_key_file,
- const CService& control_host,
+ const Proxy& control_host,
CThreadInterrupt* interrupt)
: m_private_key_file{private_key_file},
m_control_host{control_host},
@@ -124,7 +124,7 @@ Session::Session(const fs::path& private_key_file,
{
}
-Session::Session(const CService& control_host, CThreadInterrupt* interrupt)
+Session::Session(const Proxy& control_host, CThreadInterrupt* interrupt)
: m_control_host{control_host},
m_interrupt{interrupt},
m_transient{true}
@@ -327,14 +327,10 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
std::unique_ptr<Sock> Session::Hello() const
{
- auto sock = CreateSock(m_control_host);
+ auto sock = m_control_host.Connect();
if (!sock) {
- throw std::runtime_error("Cannot create socket");
- }
-
- if (!ConnectSocketDirectly(m_control_host, *sock, nConnectTimeout, true)) {
- throw std::runtime_error(strprintf("Cannot connect to %s", m_control_host.ToStringAddrPort()));
+ throw std::runtime_error(strprintf("Cannot connect to %s", m_control_host.ToString()));
}
SendRequestAndGetReply(*sock, "HELLO VERSION MIN=3.1 MAX=3.1");
@@ -418,7 +414,7 @@ void Session::CreateIfNotCreatedAlready()
const auto session_type = m_transient ? "transient" : "persistent";
const auto session_id = GetRandHash().GetHex().substr(0, 10); // full is overkill, too verbose in the logs
- Log("Creating %s SAM session %s with %s", session_type, session_id, m_control_host.ToStringAddrPort());
+ Log("Creating %s SAM session %s with %s", session_type, session_id, m_control_host.ToString());
auto sock = Hello();