diff options
Diffstat (limited to 'src/modules/netlib/netlibupnp.cpp')
-rw-r--r-- | src/modules/netlib/netlibupnp.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 45009fa341..8bec975111 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -800,18 +800,16 @@ void NetlibUPnPCleanup(void*) return;
{
- int i, incoming = 0;
- EnterCriticalSection(&csNetlibUser);
- for (i = 0; i < netlibUser.getCount(); ++i)
- {
- if (netlibUser[i]->user.flags & NUF_INCOMING)
- {
+ int incoming = 0;
+ mir_cslock lck(csNetlibUser);
+ for (int i = 0; i < netlibUser.getCount(); ++i)
+ if (netlibUser[i]->user.flags & NUF_INCOMING) {
incoming = 1;
break;
}
- }
- LeaveCriticalSection(&csNetlibUser);
- if ( !incoming) return;
+
+ if ( !incoming)
+ return;
}
if (findUPnPGateway())
|