resumeAccept 函数的逻辑看不懂

oldtwo
public function resumeAccept()
{
    // Register a listener to be notified when server socket is ready to read.
    if (static::$globalEvent && true === $this->_pauseAccept && $this->_mainSocket) {
        if ($this->transport !== 'udp') {
            static::$globalEvent->add($this->_mainSocket, EventInterface::EV_READ, array($this, 'acceptConnection'));
        } else {
            static::$globalEvent->add($this->_mainSocket, EventInterface::EV_READ, array($this, 'acceptUdpConnection'));
        }
        $this->_pauseAccept = false;
    }
}

我怎么觉得是

if (static::$globalEvent && flase === $this->_pauseAccept && $this->_mainSocket) {
 这样才对 $this->_pauseAccept =ture 不是暂停的吗   都暂停了 还怎么进行
818 1 0
1个回答

nitron

pause 暂停
resume 继续
若暂停为true,才执行resume

  • oldtwo 2022-04-27

    都暂停了 static::$globalEvent->add($this->_mainSocket, EventInterface::EV_READ, array($this, 'acceptConnection')); 这个还起作用吗

  • nitron 2022-04-27

    _pauseAccept只是一个状态标识,不是真的暂停

  • oldtwo 2022-04-27

    好的 谢谢您

年代过于久远,无法发表回答
×
🔝