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

Method Start

daemon/HTTPServer.cpp:1618–1644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1616 }
1617
1618 void HTTPServer::Start ()
1619 {
1620 bool needAuth; i2p::config::GetOption("http.auth", needAuth);
1621 std::string user; i2p::config::GetOption("http.user", user);
1622 std::string pass; i2p::config::GetOption("http.pass", pass);
1623 /* generate pass if needed */
1624 if (needAuth && pass == "") {
1625 uint8_t random[16];
1626 char alnum[] = "0123456789"
1627 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1628 "abcdefghijklmnopqrstuvwxyz";
1629 pass.resize(sizeof(random));
1630 RAND_bytes(random, sizeof(random));
1631 for (size_t i = 0; i < sizeof(random); i++) {
1632 pass[i] = alnum[random[i] % (sizeof(alnum) - 1)];
1633 }
1634 i2p::config::SetOption("http.pass", pass);
1635 LogPrint(eLogInfo, "HTTPServer: Password set to ", pass);
1636 }
1637
1638 m_IsRunning = true;
1639 m_Thread.reset (new std::thread (std::bind (&HTTPServer::Run, this)));
1640 m_Acceptor.listen ();
1641 Accept ();
1642
1643 LoadExtCSS();
1644 }
1645
1646 void HTTPServer::Stop ()
1647 {

Callers

nothing calls this directly

Calls 4

GetOptionFunction · 0.85
SetOptionFunction · 0.85
LogPrintFunction · 0.85
LoadExtCSSFunction · 0.85

Tested by

no test coverage detected