mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:29:03 +02:00
use the inactivity timer for ice-server lockup check
This commit is contained in:
parent
92e9e6a3fa
commit
e5adfc40b2
2 changed files with 5 additions and 5 deletions
|
@ -69,8 +69,6 @@ bool IceServer::packetVersionMatch(const udt::Packet& packet) {
|
||||||
|
|
||||||
void IceServer::processPacket(std::unique_ptr<udt::Packet> packet) {
|
void IceServer::processPacket(std::unique_ptr<udt::Packet> packet) {
|
||||||
|
|
||||||
_lastPacketTimestamp = QDateTime::currentMSecsSinceEpoch();
|
|
||||||
|
|
||||||
auto nlPacket = NLPacket::fromBase(std::move(packet));
|
auto nlPacket = NLPacket::fromBase(std::move(packet));
|
||||||
|
|
||||||
// make sure that this packet at least looks like something we can read
|
// make sure that this packet at least looks like something we can read
|
||||||
|
@ -282,6 +280,8 @@ void IceServer::sendPeerInformationPacket(const NetworkPeer& peer, const HifiSoc
|
||||||
void IceServer::clearInactivePeers() {
|
void IceServer::clearInactivePeers() {
|
||||||
NetworkPeerHash::iterator peerItem = _activePeers.begin();
|
NetworkPeerHash::iterator peerItem = _activePeers.begin();
|
||||||
|
|
||||||
|
_lastInactiveCheckTimestamp = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
|
||||||
while (peerItem != _activePeers.end()) {
|
while (peerItem != _activePeers.end()) {
|
||||||
SharedNetworkPeer peer = peerItem.value();
|
SharedNetworkPeer peer = peerItem.value();
|
||||||
|
|
||||||
|
@ -310,8 +310,8 @@ bool IceServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, b
|
||||||
|
|
||||||
const quint64 MAX_PACKET_GAP_MS_FOR_STUCK_SOCKET = 10 * 1000;
|
const quint64 MAX_PACKET_GAP_MS_FOR_STUCK_SOCKET = 10 * 1000;
|
||||||
|
|
||||||
int statusNumber = (QDateTime::currentMSecsSinceEpoch() - _lastPacketTimestamp > MAX_PACKET_GAP_MS_FOR_STUCK_SOCKET)
|
auto sinceLastInactiveCheck = QDateTime::currentMSecsSinceEpoch() - _lastInactiveCheckTimestamp;
|
||||||
? 1 : 0;
|
int statusNumber = (sinceLastInactiveCheck > MAX_PACKET_GAP_MS_FOR_STUCK_SOCKET) ? 1 : 0;
|
||||||
|
|
||||||
connection->respond(HTTPConnection::StatusCode200, QByteArray::number(statusNumber));
|
connection->respond(HTTPConnection::StatusCode200, QByteArray::number(statusNumber));
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
using DomainPublicKeyHash = std::unordered_map<QUuid, RSAUniquePtr>;
|
using DomainPublicKeyHash = std::unordered_map<QUuid, RSAUniquePtr>;
|
||||||
DomainPublicKeyHash _domainPublicKeys;
|
DomainPublicKeyHash _domainPublicKeys;
|
||||||
|
|
||||||
quint64 _lastPacketTimestamp;
|
quint64 _lastInactiveCheckTimestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_IceServer_h
|
#endif // hifi_IceServer_h
|
||||||
|
|
Loading…
Reference in a new issue