From 2d1f9a4b914936bafb66fc610fbe88c33d9dec2e Mon Sep 17 00:00:00 2001 From: Marius Ungureanu Date: Sat, 5 Sep 2015 10:52:23 +0300 Subject: [PATCH] Fix data race in NetPeerStatistics.BytesInRecyclePool --- Lidgren.Network/NetPeerStatistics.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lidgren.Network/NetPeerStatistics.cs b/Lidgren.Network/NetPeerStatistics.cs index 841bf0f..093bd5c 100644 --- a/Lidgren.Network/NetPeerStatistics.cs +++ b/Lidgren.Network/NetPeerStatistics.cs @@ -105,7 +105,14 @@ namespace Lidgren.Network /// /// Gets the number of bytes in the recycled pool /// - public int BytesInRecyclePool { get { return m_peer.m_storagePoolBytes; } } + public int BytesInRecyclePool + { + get + { + lock (m_peer.m_storagePool) + return m_peer.m_storagePoolBytes; + } + } #if !USE_RELEASE_STATISTICS [Conditional("DEBUG")]