Reflector: parse [TWIN] section (stub; no link behavior yet)
This commit is contained in:
1 parent
c76f07af31
commit
3c92de178c
2 files changed
+59
No files matched your search
@@ -504,6 +504,8 @@ bool Reflector::initialize(Async::Config &cfg)
|
|||||||
|
|
||||||
initTrunkLinks();
|
initTrunkLinks();
|
||||||
initTrunkServer();
|
initTrunkServer();
|
||||||
|
initTwinLink();
|
||||||
|
initTwinServer();
|
||||||
initSatelliteServer();
|
initSatelliteServer();
|
||||||
|
|
||||||
// Initialize MQTT publisher if [MQTT] section is configured
|
// Initialize MQTT publisher if [MQTT] section is configured
|
||||||
@@ -3872,6 +3874,53 @@ std::string Reflector::formatCerts(bool signedCerts, bool pendingCerts)
|
|||||||
} /* Reflector::formatCerts */
|
} /* Reflector::formatCerts */
|
||||||
|
|
||||||
|
|
||||||
|
void Reflector::initTwinLink(void)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (const auto& section : m_cfg->listSections())
|
||||||
|
{
|
||||||
|
if (section == "TWIN")
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::cout << "TWIN: section present in config (parser stub, no link yet)"
|
||||||
|
<< std::endl;
|
||||||
|
// Actual TwinLink creation lands in Task B2.
|
||||||
|
} /* Reflector::initTwinLink */
|
||||||
|
|
||||||
|
|
||||||
|
void Reflector::initTwinServer(void)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (const auto& section : m_cfg->listSections())
|
||||||
|
{
|
||||||
|
if (section == "TWIN")
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::string port_str;
|
||||||
|
if (m_cfg->getValue("GLOBAL", "TWIN_LISTEN_PORT", port_str)
|
||||||
|
&& !port_str.empty())
|
||||||
|
{
|
||||||
|
m_twin_listen_port = static_cast<uint16_t>(std::atoi(port_str.c_str()));
|
||||||
|
}
|
||||||
|
std::cout << "TWIN: listen port = " << m_twin_listen_port
|
||||||
|
<< " (server stub, not bound yet)" << std::endl;
|
||||||
|
} /* Reflector::initTwinServer */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file has not been truncated
|
* This file has not been truncated
|
||||||
*/
|
*/
|
||||||
@@ -87,6 +87,7 @@ namespace Async
|
|||||||
class ReflectorMsg;
|
class ReflectorMsg;
|
||||||
class ReflectorUdpMsg;
|
class ReflectorUdpMsg;
|
||||||
class RedisStore;
|
class RedisStore;
|
||||||
|
class TwinLink;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -331,6 +332,13 @@ class Reflector : public sigc::trackable
|
|||||||
// Handed-off inbound trunk connections mapped to their TrunkLink
|
// Handed-off inbound trunk connections mapped to their TrunkLink
|
||||||
std::map<Async::FramedTcpConnection*, TrunkLink*> m_trunk_inbound_map;
|
std::map<Async::FramedTcpConnection*, TrunkLink*> m_trunk_inbound_map;
|
||||||
|
|
||||||
|
// Twin HA-pair support
|
||||||
|
TwinLink* m_twin_link = nullptr;
|
||||||
|
Async::TcpServer<Async::FramedTcpConnection>* m_twin_srv = nullptr;
|
||||||
|
uint16_t m_twin_listen_port = 5304;
|
||||||
|
// Pending inbound twin connections awaiting MsgTrunkHello
|
||||||
|
std::map<Async::FramedTcpConnection*, Async::Timer*> m_twin_pending_cons;
|
||||||
|
|
||||||
// Satellite support
|
// Satellite support
|
||||||
bool m_is_satellite = false;
|
bool m_is_satellite = false;
|
||||||
SatelliteClient* m_satellite_client = nullptr;
|
SatelliteClient* m_satellite_client = nullptr;
|
||||||
@@ -375,6 +383,8 @@ class Reflector : public sigc::trackable
|
|||||||
void refreshStatus(void);
|
void refreshStatus(void);
|
||||||
void initTrunkLinks(void);
|
void initTrunkLinks(void);
|
||||||
void initTrunkServer(void);
|
void initTrunkServer(void);
|
||||||
|
void initTwinLink(void);
|
||||||
|
void initTwinServer(void);
|
||||||
void trunkClientConnected(Async::FramedTcpConnection* con);
|
void trunkClientConnected(Async::FramedTcpConnection* con);
|
||||||
void trunkClientDisconnected(Async::FramedTcpConnection* con,
|
void trunkClientDisconnected(Async::FramedTcpConnection* con,
|
||||||
Async::FramedTcpConnection::DisconnectReason reason);
|
Async::FramedTcpConnection::DisconnectReason reason);
|
||||||
|
|||||||
Reference in new issue
Block a user