Fix: guard send paths against writing to closed sockets; lower test port bases
Three fixes surfaced while running the E3 integration suite end-to-end: 1. sendMsgOnPairedInbound / sendMsgOnPairedOutbound / TwinLink sendMsgOn* now check isConnected() before calling write(). Without the guard, a heartbeat TX firing between the remote peer dying and our RX-timeout cleanup tripped an "assert sock >= 0" inside Async::TcpConnection::write and crashed the reflector (seen in test_07 as ref2 exiting with SIGSEGV after ref1 was killed). 2. Twin topology trunk_port_base values reduced (45000-48000) so the http-port offset (+3080) stays <= 65535. The earlier 60000-63000 bases produced 66080, which docker compose rejected as an invalid hostPort. 3. Twin reflector names lowercased (refa, refc) to satisfy Docker's image tag constraint (lowercase-only). All 7 integration tests now pass end-to-end: - twin handshake (mutual authenticated hello) - no HMAC/prefix errors on startup - refa's PAIRED=1 trunk reports connected=True - both pair members see TRUNK_IT_DE back to refa - no twin-related ERRORs in startup logs - kill ref2 -> ref1 detects timeout, restart -> re-handshakes - kill ref1 -> refa stays connected to the pair via ref2 (failover)
This commit is contained in:
1 parent
a2b5d448fa
commit
06a2275ee6
4 files changed
+43
-37
No files matched your search
@@ -1378,6 +1378,7 @@ size_t TrunkLink::pairedClientIndex(FramedTcpClient* client) const
|
||||
void TrunkLink::sendMsgOnPairedOutbound(size_t idx, const ReflectorMsg& msg)
|
||||
{
|
||||
if (idx >= m_ob_cons.size()) return;
|
||||
if (!m_ob_cons[idx]->isConnected()) return;
|
||||
ostringstream ss;
|
||||
ReflectorMsg header(msg.type());
|
||||
if (!header.pack(ss) || !msg.pack(ss))
|
||||
@@ -1405,6 +1406,7 @@ size_t TrunkLink::pairedInboundIndex(Async::FramedTcpConnection* con) const
|
||||
void TrunkLink::sendMsgOnPairedInbound(size_t idx, const ReflectorMsg& msg)
|
||||
{
|
||||
if (idx >= m_ib_cons.size()) return;
|
||||
if (!m_ib_cons[idx]->isConnected()) return;
|
||||
ostringstream ss;
|
||||
ReflectorMsg header(msg.type());
|
||||
if (!header.pack(ss) || !msg.pack(ss))
|
||||
|
||||
@@ -566,6 +566,7 @@ bool TwinLink::sendMsg(const ReflectorMsg& msg)
|
||||
|
||||
void TwinLink::sendMsgOnOutbound(const ReflectorMsg& msg)
|
||||
{
|
||||
if (!m_con.isConnected()) return;
|
||||
ostringstream ss;
|
||||
ReflectorMsg header(msg.type());
|
||||
if (!header.pack(ss) || !msg.pack(ss))
|
||||
@@ -581,7 +582,7 @@ void TwinLink::sendMsgOnOutbound(const ReflectorMsg& msg)
|
||||
|
||||
void TwinLink::sendMsgOnInbound(const ReflectorMsg& msg)
|
||||
{
|
||||
if (m_inbound_con == nullptr) return;
|
||||
if (m_inbound_con == nullptr || !m_inbound_con->isConnected()) return;
|
||||
ostringstream ss;
|
||||
ReflectorMsg header(msg.type());
|
||||
if (!header.pack(ss) || !msg.pack(ss))
|
||||
|
||||
Reference in new issue
Block a user