mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 19:27:49 +02:00
handle webconsole and tunnels bind errors (#510)
This commit is contained in:
parent
92daf21b1e
commit
2abc9807d9
4 changed files with 18 additions and 9 deletions
|
@ -322,7 +322,7 @@ namespace i2p
|
||||||
bool http; i2p::config::GetOption("http.enabled", http);
|
bool http; i2p::config::GetOption("http.enabled", http);
|
||||||
if (http) {
|
if (http) {
|
||||||
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
||||||
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
||||||
LogPrint(eLogInfo, "Daemon: starting HTTP Server at ", httpAddr, ":", httpPort);
|
LogPrint(eLogInfo, "Daemon: starting HTTP Server at ", httpAddr, ":", httpPort);
|
||||||
d.httpServer = std::unique_ptr<i2p::http::HTTPServer>(new i2p::http::HTTPServer(httpAddr, httpPort));
|
d.httpServer = std::unique_ptr<i2p::http::HTTPServer>(new i2p::http::HTTPServer(httpAddr, httpPort));
|
||||||
d.httpServer->Start();
|
d.httpServer->Start();
|
||||||
|
|
|
@ -1084,10 +1084,15 @@ namespace http {
|
||||||
i2p::config::SetOption("http.pass", pass);
|
i2p::config::SetOption("http.pass", pass);
|
||||||
LogPrint(eLogInfo, "HTTPServer: password set to ", pass);
|
LogPrint(eLogInfo, "HTTPServer: password set to ", pass);
|
||||||
}
|
}
|
||||||
m_IsRunning = true;
|
|
||||||
m_Thread = std::unique_ptr<std::thread>(new std::thread (std::bind (&HTTPServer::Run, this)));
|
try {
|
||||||
m_Acceptor.listen ();
|
m_IsRunning = true;
|
||||||
Accept ();
|
m_Thread = std::unique_ptr<std::thread>(new std::thread (std::bind (&HTTPServer::Run, this)));
|
||||||
|
m_Acceptor.listen ();
|
||||||
|
Accept ();
|
||||||
|
} catch (std::exception& ex) {
|
||||||
|
LogPrint (eLogError, "HTTPServer: failed to start webconsole: ", ex.what ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPServer::Stop ()
|
void HTTPServer::Stop ()
|
||||||
|
|
|
@ -283,10 +283,14 @@ namespace client
|
||||||
void TCPIPAcceptor::Start ()
|
void TCPIPAcceptor::Start ()
|
||||||
{
|
{
|
||||||
m_Acceptor.reset (new boost::asio::ip::tcp::acceptor (GetService (), m_LocalEndpoint));
|
m_Acceptor.reset (new boost::asio::ip::tcp::acceptor (GetService (), m_LocalEndpoint));
|
||||||
//update the local end point in case port has been set zero and got updated now
|
// update the local end point in case port has been set zero and got updated now
|
||||||
m_LocalEndpoint = m_Acceptor->local_endpoint();
|
m_LocalEndpoint = m_Acceptor->local_endpoint();
|
||||||
m_Acceptor->listen ();
|
try {
|
||||||
Accept ();
|
m_Acceptor->listen ();
|
||||||
|
Accept ();
|
||||||
|
} catch (std::exception& ex) {
|
||||||
|
LogPrint (eLogError, "I2PService: failed to start ", GetName(), " acceptor: ", ex.what ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCPIPAcceptor::Stop ()
|
void TCPIPAcceptor::Stop ()
|
||||||
|
|
|
@ -389,7 +389,7 @@ namespace client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This handler tries to stablish a connection with the desired server and dies if it fails to do so */
|
/* This handler tries to establish a connection with the desired server and dies if it fails to do so */
|
||||||
class I2PClientTunnelHandler: public I2PServiceHandler, public std::enable_shared_from_this<I2PClientTunnelHandler>
|
class I2PClientTunnelHandler: public I2PServiceHandler, public std::enable_shared_from_this<I2PClientTunnelHandler>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue