mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-10-26 05:49:59 +00:00
Don't lock the ENet mutex when querying for RTT information
This commit is contained in:
1 parent
2d984f4b0d
commit
20c05eda6a
1 file changed
+4
-2
+4
-2
@@ -1670,7 +1670,10 @@ bool isControlDataInTransit(void) {
|
|||||||
bool LiGetEstimatedRttInfo(uint32_t* estimatedRtt, uint32_t* estimatedRttVariance) {
|
bool LiGetEstimatedRttInfo(uint32_t* estimatedRtt, uint32_t* estimatedRttVariance) {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
PltLockMutex(&enetMutex);
|
// We do not acquire enetMutex here because we're just reading metrics
|
||||||
|
// and observing a torn write every once in a while is totally fine.
|
||||||
|
// The peer pointer points to memory reserved inside the client object,
|
||||||
|
// so it's guaranteed that it will never go away underneath us.
|
||||||
if (peer != NULL && peer->state == ENET_PEER_STATE_CONNECTED) {
|
if (peer != NULL && peer->state == ENET_PEER_STATE_CONNECTED) {
|
||||||
if (estimatedRtt != NULL) {
|
if (estimatedRtt != NULL) {
|
||||||
*estimatedRtt = peer->roundTripTime;
|
*estimatedRtt = peer->roundTripTime;
|
||||||
@@ -1682,7 +1685,6 @@ bool LiGetEstimatedRttInfo(uint32_t* estimatedRtt, uint32_t* estimatedRttVarianc
|
|||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
PltUnlockMutex(&enetMutex);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user