mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-22 21:44:46 +00:00
fixed deadlock
This commit is contained in:
parent
02f4835e31
commit
cc0cf35725
@ -3357,8 +3357,10 @@ void VoIPController::UpdateSignalBars(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VoIPController::UpdateQueuedPackets(){
|
void VoIPController::UpdateQueuedPackets(){
|
||||||
|
vector<PendingOutgoingPacket> packetsToSend;
|
||||||
|
{
|
||||||
MutexGuard m(queuedPacketsMutex);
|
MutexGuard m(queuedPacketsMutex);
|
||||||
for(std::vector<QueuedPacket>::iterator qp=queuedPackets.begin();qp!=queuedPackets.end();){
|
for(std::vector<QueuedPacket>::iterator qp=queuedPackets.begin(); qp!=queuedPackets.end();){
|
||||||
if(qp->timeout>0 && qp->firstSentTime>0 && GetCurrentTime()-qp->firstSentTime>=qp->timeout){
|
if(qp->timeout>0 && qp->firstSentTime>0 && GetCurrentTime()-qp->firstSentTime>=qp->timeout){
|
||||||
LOGD("Removing queued packet because of timeout");
|
LOGD("Removing queued packet because of timeout");
|
||||||
qp=queuedPackets.erase(qp);
|
qp=queuedPackets.erase(qp);
|
||||||
@ -3375,7 +3377,7 @@ void VoIPController::UpdateQueuedPackets(){
|
|||||||
qp->firstSentTime=qp->lastSentTime;
|
qp->firstSentTime=qp->lastSentTime;
|
||||||
if(qp->data.Length())
|
if(qp->data.Length())
|
||||||
buf.CopyFrom(qp->data, qp->data.Length());
|
buf.CopyFrom(qp->data, qp->data.Length());
|
||||||
SendOrEnqueuePacket(PendingOutgoingPacket{
|
packetsToSend.push_back(PendingOutgoingPacket{
|
||||||
/*.seq=*/seq,
|
/*.seq=*/seq,
|
||||||
/*.type=*/qp->type,
|
/*.type=*/qp->type,
|
||||||
/*.len=*/qp->data.Length(),
|
/*.len=*/qp->data.Length(),
|
||||||
@ -3385,6 +3387,10 @@ void VoIPController::UpdateQueuedPackets(){
|
|||||||
}
|
}
|
||||||
++qp;
|
++qp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
for(PendingOutgoingPacket& pkt:packetsToSend){
|
||||||
|
SendOrEnqueuePacket(move(pkt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoIPController::SendNopPacket(){
|
void VoIPController::SendNopPacket(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user