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);
}
if ($connection->temp_auth_key === null) {
$res = $this->unencryptedWriteLoopAsync();
} else {
$res = $this->encryptedWriteLoopAsync();
try {
$please_wait = yield $this->{$connection->temp_auth_key === null ? 'unencryptedWriteLoopAsync' : 'encryptedWriteLoopAsync'}();
} catch (Amp\ByteStream\StreamException $e) {
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();
}