mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 09:33:29 +02:00
lock then check size
This commit is contained in:
parent
036cb8859d
commit
6c4a36fb7f
1 changed files with 11 additions and 5 deletions
|
@ -155,10 +155,13 @@ void SendQueue::run() {
|
|||
}
|
||||
|
||||
// If there is no packet to resend, grab the next one in the list
|
||||
if (!nextPacket && _packets.size() > 0) {
|
||||
if (!nextPacket) {
|
||||
QWriteLocker locker(&_packetsLock);
|
||||
nextPacket.swap(_packets.front());
|
||||
_packets.pop_front();
|
||||
|
||||
if (_packets.size() > 0) {
|
||||
nextPacket.swap(_packets.front());
|
||||
_packets.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
if (nextPacket) {
|
||||
|
@ -194,8 +197,11 @@ void SendQueue::run() {
|
|||
// we've detected we should send the second packet in a pair, do that now before sleeping
|
||||
{
|
||||
QWriteLocker locker(&_packetsLock);
|
||||
pairedPacket.swap(_packets.front());
|
||||
_packets.pop_front();
|
||||
|
||||
if (_packets.size() > 0) {
|
||||
pairedPacket.swap(_packets.front());
|
||||
_packets.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
if (pairedPacket) {
|
||||
|
|
Loading…
Reference in a new issue