1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 07:34:41 +01:00

Improve timeout

This commit is contained in:
Daniil Gentili 2023-08-20 23:54:12 +02:00
parent 4f1fe77ad3
commit 3fb7d6a036

View File

@ -408,6 +408,12 @@ final class VoIPController
}
private function connectToAll(): void
{
$this->timeoutWatcher = EventLoop::repeat(10, function (): void {
if (\microtime(true) - $this-lastIncomingTimestamp > 10) {
$this->discard(DiscardReason::DISCONNECTED);
}
});
$promises = [];
foreach ($this->sockets as $socket) {
$promise = async(function () use ($socket): void {
@ -528,12 +534,6 @@ final class VoIPController
{
$this->setVoipState(VoIPState::ESTABLISHED);
$this->timeoutWatcher = EventLoop::repeat(10, function (): void {
if (\microtime(true) - $this->lastIncomingTimestamp > 10) {
$this->discard(DiscardReason::DISCONNECTED);
}
});
$delay = $this->muted ? 0.2 : 0.06;
$t = \microtime(true) + $delay;
while (true) {