mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 00:34:20 +00:00
tabify
This commit is contained in:
parent
1e1e4da144
commit
b046c45a9e
@ -207,7 +207,7 @@ namespace client
|
|||||||
void SAMSocket::HandleMessageReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred, bool close)
|
void SAMSocket::HandleMessageReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred, bool close)
|
||||||
{
|
{
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "SAM: reply send error: ", ecode.message ());
|
LogPrint (eLogError, "SAM: reply send error: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ("SAM: reply send error");
|
Terminate ("SAM: reply send error");
|
||||||
@ -224,7 +224,7 @@ namespace client
|
|||||||
void SAMSocket::HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
void SAMSocket::HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
||||||
{
|
{
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "SAM: read error: ", ecode.message ());
|
LogPrint (eLogError, "SAM: read error: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ("SAM: read error");
|
Terminate ("SAM: read error");
|
||||||
@ -569,7 +569,7 @@ namespace client
|
|||||||
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
||||||
#else
|
#else
|
||||||
size_t l = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY,
|
size_t l = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_DEST_REPLY,
|
||||||
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
keys.GetPublic ()->ToBase64 ().c_str (), keys.ToBase64 ().c_str ());
|
||||||
#endif
|
#endif
|
||||||
SendMessageReply (m_Buffer, l, false);
|
SendMessageReply (m_Buffer, l, false);
|
||||||
}
|
}
|
||||||
|
@ -92,12 +92,12 @@ namespace client
|
|||||||
|
|
||||||
void Terminate (const char* reason);
|
void Terminate (const char* reason);
|
||||||
|
|
||||||
bool IsSession(const std::string & id) const;
|
bool IsSession(const std::string & id) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void TerminateClose() { Terminate(nullptr); }
|
void TerminateClose() { Terminate(nullptr); }
|
||||||
|
|
||||||
void HandleHandshakeReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
void HandleHandshakeReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||||
void HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
void HandleHandshakeReplySent (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||||
void HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
void HandleMessage (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||||
void SendMessageReply (const char * msg, size_t len, bool close);
|
void SendMessageReply (const char * msg, size_t len, bool close);
|
||||||
@ -131,8 +131,8 @@ namespace client
|
|||||||
void WriteI2PDataImmediate(uint8_t * ptr, size_t sz);
|
void WriteI2PDataImmediate(uint8_t * ptr, size_t sz);
|
||||||
|
|
||||||
void HandleWriteI2PDataImmediate(const boost::system::error_code & ec, uint8_t * buff);
|
void HandleWriteI2PDataImmediate(const boost::system::error_code & ec, uint8_t * buff);
|
||||||
void HandleStreamSend(const boost::system::error_code & ec);
|
void HandleStreamSend(const boost::system::error_code & ec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SAMBridge& m_Owner;
|
SAMBridge& m_Owner;
|
||||||
@ -150,10 +150,10 @@ namespace client
|
|||||||
|
|
||||||
struct SAMSession
|
struct SAMSession
|
||||||
{
|
{
|
||||||
SAMBridge & m_Bridge;
|
SAMBridge & m_Bridge;
|
||||||
std::shared_ptr<ClientDestination> localDestination;
|
std::shared_ptr<ClientDestination> localDestination;
|
||||||
std::shared_ptr<boost::asio::ip::udp::endpoint> UDPEndpoint;
|
std::shared_ptr<boost::asio::ip::udp::endpoint> UDPEndpoint;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
|
||||||
SAMSession (SAMBridge & parent, const std::string & name, std::shared_ptr<ClientDestination> dest);
|
SAMSession (SAMBridge & parent, const std::string & name, std::shared_ptr<ClientDestination> dest);
|
||||||
~SAMSession ();
|
~SAMSession ();
|
||||||
@ -172,24 +172,24 @@ namespace client
|
|||||||
void Stop ();
|
void Stop ();
|
||||||
|
|
||||||
boost::asio::io_service& GetService () { return m_Service; };
|
boost::asio::io_service& GetService () { return m_Service; };
|
||||||
std::shared_ptr<SAMSession> CreateSession (const std::string& id, const std::string& destination, // empty string means transient
|
std::shared_ptr<SAMSession> CreateSession (const std::string& id, const std::string& destination, // empty string means transient
|
||||||
const std::map<std::string, std::string> * params);
|
const std::map<std::string, std::string> * params);
|
||||||
void CloseSession (const std::string& id);
|
void CloseSession (const std::string& id);
|
||||||
std::shared_ptr<SAMSession> FindSession (const std::string& id) const;
|
std::shared_ptr<SAMSession> FindSession (const std::string& id) const;
|
||||||
|
|
||||||
std::list<std::shared_ptr<SAMSocket> > ListSockets(const std::string & id) const;
|
std::list<std::shared_ptr<SAMSocket> > ListSockets(const std::string & id) const;
|
||||||
|
|
||||||
/** send raw data to remote endpoint from our UDP Socket */
|
/** send raw data to remote endpoint from our UDP Socket */
|
||||||
void SendTo(const uint8_t * buf, size_t len, std::shared_ptr<boost::asio::ip::udp::endpoint> remote);
|
void SendTo(const uint8_t * buf, size_t len, std::shared_ptr<boost::asio::ip::udp::endpoint> remote);
|
||||||
|
|
||||||
void RemoveSocket(const std::shared_ptr<SAMSocket> & socket);
|
void RemoveSocket(const std::shared_ptr<SAMSocket> & socket);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void Run ();
|
void Run ();
|
||||||
|
|
||||||
void Accept ();
|
void Accept ();
|
||||||
void HandleAccept(const boost::system::error_code& ecode, std::shared_ptr<SAMSocket> socket);
|
void HandleAccept(const boost::system::error_code& ecode, std::shared_ptr<SAMSocket> socket);
|
||||||
|
|
||||||
void ReceiveDatagram ();
|
void ReceiveDatagram ();
|
||||||
void HandleReceivedDatagram (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
void HandleReceivedDatagram (const boost::system::error_code& ecode, std::size_t bytes_transferred);
|
||||||
@ -204,8 +204,8 @@ namespace client
|
|||||||
boost::asio::ip::udp::socket m_DatagramSocket;
|
boost::asio::ip::udp::socket m_DatagramSocket;
|
||||||
mutable std::mutex m_SessionsMutex;
|
mutable std::mutex m_SessionsMutex;
|
||||||
std::map<std::string, std::shared_ptr<SAMSession> > m_Sessions;
|
std::map<std::string, std::shared_ptr<SAMSession> > m_Sessions;
|
||||||
mutable std::mutex m_OpenSocketsMutex;
|
mutable std::mutex m_OpenSocketsMutex;
|
||||||
std::list<std::shared_ptr<SAMSocket> > m_OpenSockets;
|
std::list<std::shared_ptr<SAMSocket> > m_OpenSockets;
|
||||||
uint8_t m_DatagramReceiveBuffer[i2p::datagram::MAX_DATAGRAM_SIZE+1];
|
uint8_t m_DatagramReceiveBuffer[i2p::datagram::MAX_DATAGRAM_SIZE+1];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user