mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +02:00
fix a couple of bugs in SendQueue
This commit is contained in:
parent
0f1d1a16a7
commit
1724e3c632
1 changed files with 50 additions and 44 deletions
|
@ -62,7 +62,9 @@ void SendQueue::run() {
|
|||
// We need to make sure this is called on the right thread
|
||||
if (thread() != QThread::currentThread()) {
|
||||
QMetaObject::invokeMethod(this, "run", Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
_isRunning = true;
|
||||
|
||||
// This will loop and sleep to send packets
|
||||
|
@ -161,12 +163,13 @@ void SendQueue::loop() {
|
|||
}
|
||||
|
||||
// If there is no packet to resend, grab the next one in the list
|
||||
if (!nextPacket) {
|
||||
if (!nextPacket && _packets.size() > 0) {
|
||||
QWriteLocker locker(&_packetsLock);
|
||||
nextPacket.swap(_packets.front());
|
||||
_packets.pop_front();
|
||||
}
|
||||
|
||||
if (nextPacket) {
|
||||
bool shouldSendSecondOfPair = false;
|
||||
|
||||
if (!hasResend) {
|
||||
|
@ -217,6 +220,9 @@ void SendQueue::loop() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// since we're a while loop, give the thread a chance to process events
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
|
|
Loading…
Reference in a new issue