Skip to content

Commit

Permalink
add logic check to timeout a data call after 60 seconds;
Browse files Browse the repository at this point in the history
  • Loading branch information
gatekeep committed Jul 7, 2024
1 parent 942793e commit 0e43cf8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/fne/network/callhandler/packetdata/P25PacketData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ using namespace p25::defines;
#include <cassert>
#include <chrono>

// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------

const uint8_t DATA_CALL_COLL_TIMEOUT = 60U;

// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -70,6 +76,17 @@ bool P25PacketData::processFrame(const uint8_t* data, uint32_t len, uint32_t pee
if (streamId != status->streamId) {
LogWarning(LOG_NET, "P25, Data Call Collision, peer = %u, streamId = %u, rxPeer = %u, rxLlId = %u, rxStreamId = %u, external = %u",
peerId, streamId, status->peerId, status->llId, status->streamId, external);

uint64_t duration = hrc::diff(pktTime, status->callStartTime);

if ((duration / 1000) > DATA_CALL_COLL_TIMEOUT) {
LogWarning(LOG_NET, "P25, force clearing stuck data call, timeout, peer = %u, streamId = %u, rxPeer = %u, rxLlId = %u, rxStreamId = %u, external = %u",
peerId, streamId, status->peerId, status->llId, status->streamId, external);

delete status;
m_status.erase(peerId);
}

return false;
}
} else {
Expand Down

0 comments on commit 0e43cf8

Please sign in to comment.