mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Merge pull request #1889 from polistern/feat/sam-udp-port
Added SAM UDP port parameter
This commit is contained in:
@@ -63,18 +63,19 @@ namespace client
|
||||
if (sam)
|
||||
{
|
||||
std::string samAddr; i2p::config::GetOption("sam.address", samAddr);
|
||||
uint16_t samPort; i2p::config::GetOption("sam.port", samPort);
|
||||
uint16_t samPortTCP; i2p::config::GetOption("sam.port", samPortTCP);
|
||||
uint16_t samPortUDP; i2p::config::GetOption("sam.portudp", samPortUDP);
|
||||
bool singleThread; i2p::config::GetOption("sam.singlethread", singleThread);
|
||||
LogPrint(eLogInfo, "Clients: Starting SAM bridge at ", samAddr, ":", samPort);
|
||||
LogPrint(eLogInfo, "Clients: Starting SAM bridge at ", samAddr, ":[", samPortTCP, "|", samPortUDP, "]");
|
||||
try
|
||||
{
|
||||
m_SamBridge = new SAMBridge (samAddr, samPort, singleThread);
|
||||
m_SamBridge = new SAMBridge (samAddr, samPortTCP, samPortUDP, singleThread);
|
||||
m_SamBridge->Start ();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LogPrint(eLogError, "Clients: Exception in SAM bridge: ", e.what());
|
||||
ThrowFatal ("Unable to start SAM bridge at ", samAddr, ":", samPort, ": ", e.what ());
|
||||
ThrowFatal ("Unable to start SAM bridge at ", samAddr, ":[", samPortTCP, "|", samPortUDP,"]: ", e.what ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1244,10 +1244,10 @@ namespace client
|
||||
// TODO: implement datagrams
|
||||
}
|
||||
|
||||
SAMBridge::SAMBridge (const std::string& address, int port, bool singleThread):
|
||||
SAMBridge::SAMBridge (const std::string& address, int portTCP, int portUDP, bool singleThread):
|
||||
RunnableService ("SAM"), m_IsSingleThread (singleThread),
|
||||
m_Acceptor (GetIOService (), boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address), port)),
|
||||
m_DatagramEndpoint (boost::asio::ip::address::from_string(address), port-1), m_DatagramSocket (GetIOService (), m_DatagramEndpoint),
|
||||
m_Acceptor (GetIOService (), boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address), portTCP)),
|
||||
m_DatagramEndpoint (boost::asio::ip::address::from_string(address), (!portUDP) ? portTCP-1 : portUDP), m_DatagramSocket (GetIOService (), m_DatagramEndpoint),
|
||||
m_SignatureTypes
|
||||
{
|
||||
{"DSA_SHA1", i2p::data::SIGNING_KEY_TYPE_DSA_SHA1},
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace client
|
||||
{
|
||||
public:
|
||||
|
||||
SAMBridge (const std::string& address, int port, bool singleThread);
|
||||
SAMBridge (const std::string& address, int portTCP, int portUDP, bool singleThread);
|
||||
~SAMBridge ();
|
||||
|
||||
void Start ();
|
||||
|
||||
Reference in New Issue
Block a user