Fix incorrect mutex usage

feature/pre-code-move
kaetemi 5 years ago committed by Jan Boon
parent e2610a025c
commit 695ebeb0ef

@ -66,19 +66,17 @@ class CCallbackClientAdaptor : public CNelCallbackClientAdaptor
virtual void send(const NLNET::CMessage &buffer, NLNET::TSockId hostid = NLNET::InvalidSockId, bool log = true) virtual void send(const NLNET::CMessage &buffer, NLNET::TSockId hostid = NLNET::InvalidSockId, bool log = true)
{ {
CAutoMutex<CUnfairMutex> mutex1(_Mutex); CAutoMutex<CUnfairMutex> mutex(_Mutex);
if (!_PassThrue) if (!_PassThrue)
{ {
// queue the message for later sending. // queue the message for later sending.
nldebug("SB: Pushing a buffer into SendQueue (from %u elts)", _SendQueue.size()); nldebug("SB: Pushing a buffer into SendQueue (from %u elts)", _SendQueue.size());
CAutoMutex<CUnfairMutex> mutex(_Mutex);
_SendQueue.push(buffer); _SendQueue.push(buffer);
} }
else else
{ {
// protect socket because update() can be called in the main thread while send() can be called with passthru=true in the session browser thread (by authenticate() for example) // protect socket because update() can be called in the main thread while send() can be called with passthru=true in the session browser thread (by authenticate() for example)
CAutoMutex<CUnfairMutex> mutex(_Mutex);
_CallbackClient.send(buffer, hostid, log); _CallbackClient.send(buffer, hostid, log);
} }
} }

Loading…
Cancel
Save