fix: update sendPing to set source ID before sequence number for proper header resizing
This commit is contained in:
@@ -1538,10 +1538,13 @@ void OverteClient::handlePing(const char* payload, size_t len) {
|
|||||||
void OverteClient::sendPing(int fd, const sockaddr_storage& addr, socklen_t addrLen) {
|
void OverteClient::sendPing(int fd, const sockaddr_storage& addr, socklen_t addrLen) {
|
||||||
// Create NLPacket for Ping with correct version
|
// Create NLPacket for Ping with correct version
|
||||||
NLPacket packet(PacketType::Ping, PacketVersions::Ping_IncludeConnectionID, false);
|
NLPacket packet(PacketType::Ping, PacketVersions::Ping_IncludeConnectionID, false);
|
||||||
// Include our local ID if we have one (sourced packet)
|
|
||||||
|
// Set source ID first (this resizes header and writes it)
|
||||||
if (m_localID != 0) {
|
if (m_localID != 0) {
|
||||||
packet.setSourceID(m_localID);
|
packet.setSourceID(m_localID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Then set sequence number (this updates the header without resizing)
|
||||||
packet.setSequenceNumber(m_sequenceNumber++);
|
packet.setSequenceNumber(m_sequenceNumber++);
|
||||||
|
|
||||||
// Add timestamp (microseconds since epoch)
|
// Add timestamp (microseconds since epoch)
|
||||||
|
|||||||
Reference in New Issue
Block a user