MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / SSU2Session

Method SSU2Session

libi2pd/SSU2Session.cpp:83–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82
83 SSU2Session::SSU2Session (SSU2Server& server, std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter,
84 std::shared_ptr<const i2p::data::RouterInfo::Address> addr):
85 TransportSession (in_RemoteRouter, SSU2_CONNECT_TIMEOUT),
86 m_Server (server), m_Address (addr), m_RemoteTransports (0), m_RemotePeerTestTransports (0),
87 m_RemoteVersion (0), m_DestConnID (0), m_SourceConnID (0), m_State (eSSU2SessionStateUnknown),
88 m_SendPacketNum (0), m_ReceivePacketNum (0), m_LastDatetimeSentPacketNum (0),
89 m_IsDataReceived (false), m_RTT (SSU2_UNKNOWN_RTT),
90 m_MsgLocalExpirationTimeout (I2NP_MESSAGE_LOCAL_EXPIRATION_TIMEOUT_MAX),
91 m_MsgLocalSemiExpirationTimeout (I2NP_MESSAGE_LOCAL_EXPIRATION_TIMEOUT_MAX / 2),
92 m_WindowSize (SSU2_MIN_WINDOW_SIZE),
93 m_RTO (SSU2_INITIAL_RTO), m_RelayTag (0),m_ConnectTimer (server.GetService ()),
94 m_TerminationReason (eSSU2TerminationReasonNormalClose),
95 m_MaxPayloadSize (SSU2_MAX_PACKET_SIZE - IPV6_HEADER_SIZE - UDP_HEADER_SIZE - 32), // max size
96 m_LastResendTime (0), m_LastResendAttemptTime (0), m_NextRouterInfoResendTime(0),
97 m_NumRanges (0)
98 {
99 if (in_RemoteRouter && m_Address)
100 {
101 // outgoing
102 m_RemoteEndpoint = boost::asio::ip::udp::endpoint (m_Address->host, m_Address->port);
103 m_RemoteTransports = in_RemoteRouter->GetCompatibleTransports (false);
104 m_RemoteVersion = in_RemoteRouter->GetVersion ();
105 if (in_RemoteRouter->IsSSU2PeerTesting (true)) m_RemotePeerTestTransports |= i2p::data::RouterInfo::eSSU2V4;
106 if (in_RemoteRouter->IsSSU2PeerTesting (false)) m_RemotePeerTestTransports |= i2p::data::RouterInfo::eSSU2V6;
107 RAND_bytes ((uint8_t *)&m_DestConnID, 8);
108 RAND_bytes ((uint8_t *)&m_SourceConnID, 8);
109 AdjustMaxPayloadSize ();
110 }
111 }
112
113 SSU2Session::~SSU2Session ()
114 {

Callers

nothing calls this directly

Calls 3

IsSSU2PeerTestingMethod · 0.80
GetVersionMethod · 0.45

Tested by

no test coverage detected