mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 10:45:50 +00:00
Compare commits
2 Commits
sync-2.2.1
...
datagram-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0eba2092ac | ||
|
|
ae34bbb080 |
@@ -1527,7 +1527,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline)
|
||||
reportingETL_->start();
|
||||
|
||||
// Datagram monitor if applicable
|
||||
if (!config_->standalone() && config_->DATAGRAM_MONITOR != "")
|
||||
if (!config_->standalone() && !config_->DATAGRAM_MONITOR.empty())
|
||||
{
|
||||
datagram_monitor_ = std::make_unique<DatagramMonitor>(*this);
|
||||
if (datagram_monitor_)
|
||||
|
||||
@@ -996,15 +996,24 @@ private:
|
||||
void
|
||||
monitorThread()
|
||||
{
|
||||
auto endpoint = parseEndpoint(app_.config().DATAGRAM_MONITOR);
|
||||
int sock = createSocket(endpoint);
|
||||
std::vector<std::pair<EndpointInfo, int>> endpoints;
|
||||
|
||||
for (auto const& epStr : app_.config().DATAGRAM_MONITOR)
|
||||
{
|
||||
auto endpoint = parseEndpoint(epStr);
|
||||
endpoints.push_back(
|
||||
std::make_pair(endpoint, createSocket(endpoint)));
|
||||
}
|
||||
|
||||
while (running_)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto info = generateServerInfo();
|
||||
sendPacket(sock, endpoint, info);
|
||||
for (auto const& ep : endpoints)
|
||||
{
|
||||
sendPacket(ep.second, ep.first, info);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
@@ -1015,7 +1024,10 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
close(sock);
|
||||
for (auto const& ep : endpoints)
|
||||
{
|
||||
close(ep.second);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
std::map<std::string, PublicKey>
|
||||
IMPORT_VL_KEYS; // hex string -> class PublicKey (for caching purposes)
|
||||
|
||||
std::string DATAGRAM_MONITOR;
|
||||
std::vector<std::string> DATAGRAM_MONITOR;
|
||||
|
||||
enum StartUpType {
|
||||
FRESH,
|
||||
|
||||
@@ -510,11 +510,10 @@ Config::loadFromString(std::string const& fileContents)
|
||||
NETWORK_ID = beast::lexicalCastThrow<uint32_t>(strTemp);
|
||||
}
|
||||
|
||||
if (getSingleSection(secConfig, SECTION_DATAGRAM_MONITOR, strTemp, j_))
|
||||
if (auto s = getIniFileSection(secConfig, SECTION_DATAGRAM_MONITOR))
|
||||
{
|
||||
std::vector<std::string> vecTemp{strTemp};
|
||||
replaceColons(vecTemp);
|
||||
DATAGRAM_MONITOR = vecTemp[0];
|
||||
DATAGRAM_MONITOR = *s;
|
||||
replaceColons(DATAGRAM_MONITOR);
|
||||
}
|
||||
|
||||
if (getSingleSection(secConfig, SECTION_PEER_PRIVATE, strTemp, j_))
|
||||
|
||||
Reference in New Issue
Block a user