Handle stream errors

This commit is contained in:
Daniil Gentili 2019-06-04 18:24:25 +02:00
parent 5b5c81b221
commit 2614c863a4

View File

@ -60,12 +60,16 @@ class WriteLoop extends ResumableSignalLoop
$API->logger->logger("Done waiting in $this", Logger::ULTRA_VERBOSE); $API->logger->logger("Done waiting in $this", Logger::ULTRA_VERBOSE);
} }
if ($connection->temp_auth_key === null) { try {
$res = $this->unencryptedWriteLoopAsync(); $please_wait = yield $this->{$connection->temp_auth_key === null ? 'unencryptedWriteLoopAsync' : 'encryptedWriteLoopAsync'}();
} else { } catch (Amp\ByteStream\StreamException $e) {
$res = $this->encryptedWriteLoopAsync(); if (isset($connection->old)) {
return;
}
$API->logger->logger("Got nothing in the socket in DC {$datacenter}, reconnecting...", Logger::ERROR);
yield $connection->reconnect();
continue;
} }
$please_wait = yield $res;
//$connection->waiter->resume(); //$connection->waiter->resume();
} }