src/mg/Ding/Helpers/Tcp/TcpServerHelper.php
public function processPeers()
    {
        // Control peers.
        if (count($this->_peers) < 1) {
            return;
        }
        $now = $this->getMicrotime();
        foreach ($this->_peers as $peerName => $peer) {
            if (!$peer->hasActivity()) {
                continue;
            }
            $buffer = '';
            $len = 1;
            $len = $peer->read($buffer, $len, true);
            if ($len > 0) {
                if ($len >= $this->_readLen) {
                    $this->_handler->handleData($peer);
                    $this->_peersLastDataReceived[$peerName] = $now;
                }
            } else {
                $peer->disconnect();
                $this->_freePeer($peer);
                $this->_handler->disconnect($peer);
            }
        }
        foreach ($this->_peers as $peerName => $peer) {
            $peerTime = $this->_peersLastDataReceived[$peerName];
            if (($now - $peerTime) > $this->_rTo) {
                if ($this->_rTo > 0) {
                    $peer->disconnect();
                    $this->_freePeer($peer);
                    $this->_handler->readTimeout($peer);
                }
                $this->_peersLastDataReceived[$peerName] = $now;
            }
        }
    }
public function processPeers()
    {
        // Control peers.
        if (count($this->_peers) < 1) {
            return;
        }
        $now = $this->getMicrotime();
        foreach ($this->_peers as $peerName => $peer) {
            if (!$peer->hasActivity()) {
                continue;
            }
            $buffer = '';
            $len = 1;
            $len = $peer->read($buffer, $len, true);
            if ($len > 0) {
                if ($len >= $this->_readLen) {
                    $this->_handler->handleData($peer);
                    $this->_peersLastDataReceived[$peerName] = $now;
                }
            } else {
                $peer->disconnect();
                $this->_freePeer($peer);
                $this->_handler->disconnect($peer);
            }
        }
        foreach ($this->_peers as $peerName => $peer) {
            $peerTime = $this->_peersLastDataReceived[$peerName];
            if (($now - $peerTime) > $this->_rTo) {
                if ($this->_rTo > 0) {
                    $peer->disconnect();
                    $this->_freePeer($peer);
                    $this->_handler->readTimeout($peer);
                }
                $this->_peersLastDataReceived[$peerName] = $now;
            }
        }
    }
This will process activity in all peers. Called from process().

@return void