mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 15:14:39 +01:00
BC for GenericLoop
This commit is contained in:
parent
c4527bc72c
commit
0d0047ad76
@ -225,6 +225,9 @@ class API extends InternalDoc
|
|||||||
protected function reconnectFull(): \Generator
|
protected function reconnectFull(): \Generator
|
||||||
{
|
{
|
||||||
if ($this->API instanceof Client) {
|
if ($this->API instanceof Client) {
|
||||||
|
if (yield $this->API->hasEventHandler()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
yield $this->API->stopIpcServer();
|
yield $this->API->stopIpcServer();
|
||||||
yield $this->API->disconnect();
|
yield $this->API->disconnect();
|
||||||
yield from $this->connectToMadelineProto(new SettingsEmpty, true);
|
yield from $this->connectToMadelineProto(new SettingsEmpty, true);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
namespace danog\MadelineProto\Loop\Generic;
|
namespace danog\MadelineProto\Loop\Generic;
|
||||||
|
|
||||||
|
use Amp\Promise;
|
||||||
use danog\Loop\Generic\GenericLoop as GenericGenericLoop;
|
use danog\Loop\Generic\GenericLoop as GenericGenericLoop;
|
||||||
use danog\MadelineProto\InternalDoc;
|
use danog\MadelineProto\InternalDoc;
|
||||||
use danog\MadelineProto\Loop\APILoop;
|
use danog\MadelineProto\Loop\APILoop;
|
||||||
@ -45,4 +46,16 @@ class GenericLoop extends GenericGenericLoop
|
|||||||
$this->init($API);
|
$this->init($API);
|
||||||
parent::__construct($callable, $name);
|
parent::__construct($callable, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause the loop.
|
||||||
|
*
|
||||||
|
* @param ?int $time For how long to pause the loop, if null will pause forever (until resume is called from outside of the loop)
|
||||||
|
*
|
||||||
|
* @return Promise Resolved when the loop is resumed
|
||||||
|
*/
|
||||||
|
public function pause(?int $time = null): Promise
|
||||||
|
{
|
||||||
|
return parent::pause(is_integer($time) ? $time * 1000 : $time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user