Called when new data received
@return void
764330
public function onRead()
    {
        start:
        if ($this->type === 'udp') {
            $this->onUdpPacket($this->read($this->getInputLength()));
            return;
        }
        if ($this->state === self::STATE_ROOT) {
            if (false === ($hdr = $this->readExact(2))) {
                return; // not enough data
            }
            $this->pctSize = Binary::bytes2int($hdr);
            $this->setWatermark($this->pctSize);
            $this->state = self::STATE_PACKET;
        }
        if ($this->state === self::STATE_PACKET) {
            if (false === ($pct = $this->readExact($this->pctSize))) {
                return; // not enough data
            }
            $this->state = self::STATE_ROOT;
            $this->setWatermark(2);
            $this->onUdpPacket($pct);
        }
        goto start;
    }
718461
public function onRead()
    {
        if ($this->state === self::STATE_PREHANDSHAKE) {
            if (!$this->handshake()) {
                return;
            }
        }
        if ($this->state === self::STATE_HANDSHAKED) {
            while (($buflen = $this->getInputLength()) >= 2) {
                $first = ord($this->look(1)); // first byte integer (fin, opcode)
                $firstBits = Binary::getbitmap($first);
                $opcode = (int)bindec(substr($firstBits, 4, 4));
                if ($opcode === 0x8) { // CLOSE
                    $this->finish();
                    return;
                }
                $opcodeName = isset(static::$opcodes[$opcode]) ? static::$opcodes[$opcode] : false;
                if (!$opcodeName) {
                    Daemon::log(get_class($this) . ': Undefined opcode ' . $opcode);
                    $this->finish();
                    return;
                }
                if ($this->firstFrameOpcodeName === null) {
                    $this->firstFrameOpcodeName = $opcodeName;
                }
                $second = ord($this->look(1, 1)); // second byte integer (masked, payload length)
                $fin = (bool)($first >> 7);
                $isMasked = (bool)($second >> 7);
                $dataLength = $second & 0x7f;
                $p = 2;
                if ($dataLength === 0x7e) { // 2 bytes-length
                    if ($buflen < $p + 2) {
                        return; // not enough data yet
                    }
                    $dataLength = Binary::bytes2int($this->look(2, $p), false);
                    $p += 2;
                } elseif ($dataLength === 0x7f) { // 8 bytes-length
                    if ($buflen < $p + 8) {
                        return; // not enough data yet
                    }
                    $dataLength = Binary::bytes2int($this->look(8, $p));
                    $p += 8;
                }
                if ($this->pool->maxAllowedPacket <= $dataLength) {
                    // Too big packet
                    Daemon::log(get_class($this) . ': MaxAllowedPacket limit exceeded. Packet size ' . $dataLength . ' bytes when limit ' . $this->pool->maxAllowedPacket . ' bytes');
                    $this->finish();
                    return;
                }
                // Extend buffer size to accommodate all data
                $this->setWatermark(null, $dataLength + 100);
                if ($isMasked) {
                    if ($buflen < $p + 4) {
                        return; // not enough data yet
                    }
                    $mask = $this->look(4, $p);
                    $p += 4;
                }
                if ($buflen < $p + $dataLength) {
                    return; // not enough data yet
                }
                $this->drain($p);
                $data = $this->read($dataLength);
                if ($isMasked) {
                    $data = $this->mask($data, $mask);
                }
                //Daemon::log(Debug::dump(array('ext' => $this->extensions, 'rsv1' => $firstBits[1], 'data' => Debug::exportBytes($data))));
                /*if ($firstBits[1] && in_array('deflate-frame', $this->extensions)) { // deflate frame
                    $data = gzuncompress($data, $this->pool->maxAllowedPacket);
                }*/
                if (!$fin) {
                    $this->framebuf .= $data;
                } else {
                    $this->onFrame($this->framebuf . $data, $this->firstFrameOpcodeName);
                    $this->firstFrameOpcodeName = null;
                    $this->framebuf = '';
                }
            }
        }
    }
1149323
public function markRead()
    {
        if ($this->receiver_status == Message::STATUS_NEW) {
            $this->receiver_status = Message::STATUS_READ;
            if ($this->save()) {
                Podium::getInstance()->podiumCache->deleteElement('user.newmessages', $this->receiver_id);
            }
        }
    }
645842
protected function onInput($data)
    {
        $this->index++;
        if ($this->index >= $this->offset && $this->index < $this->offset + $this->limit) {
            $this->next($data);
        }
    }
83028
final protected function _loadData()
    {
        if (!$this->isLoaded()) {
            $this->_object_set = new ArrayObject();
            foreach ($this->_getData() as $object) {
                $this->insert($object);
            }
        }
    }
31479
@Override
    public final void received () {
        if ( isAsync() && getStatus() == NtStatus.NT_STATUS_PENDING ) {
            synchronized ( this ) {
                notifyAll();
            }
            return;
        }
        this.received = true;
        synchronized ( this ) {
            notifyAll();
        }
    }
73393
public function onRead()
    {
        if (($head = $this->lookExact(static::HEADER_LENGTH)) === false) {
            return;
        }

        list($magic, $typeInt, $size) = unpack(static::HEADER_READ_FORMAT, $head);

        if ($this->getInputLength() < static::HEADER_LENGTH + $size) {
            return;
        }

        $this->drain(static::HEADER_LENGTH);
        $pct = $this->read($size);

        if ($magic === static::MAGIC_RESPONSE) {
            $this->responseType = static::$responseCommandListFlipped[$typeInt];
            $this->response = explode(static::ARGS_DELIMITER, $pct);
            $this->onResponse->executeOne($this);
            $this->responseType = null;
            $this->responseCommand = null;
            $this->responseType = null;
            $this->checkFree();
            return;
        } else {
            $type = static::$requestCommandListFlipped[$typeInt];
            // @TODO
        }
    }
178012
protected function onFileChanged()
    {
        $this->firstLinesRaw = null;
        $this->firstLines = null;
        if ($this->separatorWasDetected) {
            $this->separator = '';
            $this->separatorWasDetected = false;
        }
        if ($this->headerWasDetected) {
            $this->setHeader([]);
            $this->headerWasDetected = false;
        }
    }
950988
public function onReady()
    {
        $conn = $this;
        $this->keepaliveTimer = setTimeout(function ($timer) use ($conn) {
            $conn->ping();
        }, 10e6);
    }
758485
public function onUpdate() {
    
    if (file_exists($this->savedTimestampPath)) {
      $readTimestamp = file_get_contents($this->savedTimestampPath);
      if ($readTimestamp != $this->savedTimestamp) {
        foreach ($this->clients as $sendto) {
          $sendto->send($readTimestamp);
        }
        $this->savedTimestamp = $readTimestamp;
      }
    }
    
  }
1001174
protected function onRead()
    {
        if (!$this->policyReqNotFound) {
            $d = $this->drainIfMatch("<policy-file-request/>\x00");
            if ($d === null) { // partially match
                return;
            }
            if ($d) {
                if (($FP = \PHPDaemon\Servers\FlashPolicy\Pool::getInstance($this->pool->config->fpsname->value,
                        false)) && $FP->policyData
                ) {
                    $this->write($FP->policyData . "\x00");
                }
                $this->finish();
                return;
            } else {
                $this->policyReqNotFound = true;
            }
        }
        start:
        if ($this->finished) {
            return;
        }
        if ($this->state === self::STATE_STANDBY) {
            $this->state = self::STATE_FIRSTLINE;
        }
        if ($this->state === self::STATE_FIRSTLINE) {
            if (!$this->httpReadFirstline()) {
                return;
            }
            $this->state = self::STATE_HEADERS;
        }

        if ($this->state === self::STATE_HEADERS) {
            if (!$this->httpReadHeaders()) {
                return;
            }
            if (!$this->httpProcessHeaders()) {
                $this->finish();
                return;
            }
            $this->state = self::STATE_CONTENT;
        }
        if ($this->state === self::STATE_CONTENT) {
            $this->state = self::STATE_PREHANDSHAKE;
        }
    }
24406
public function received()
    {
        $model = $this->noInitModel;
        return $this->likeCondition($model->initDatetime(), $model->receivedAtAttribute, 'not in');
    }
573421
def process_data(self):

        
        self.trigger("process-data", self.received_data)
        self.received_data = ""
        if self.dispatcher:
            self.time = self.dispatcher.time
161382
protected function onInputEnd()
    {
        foreach ($this->container[0]["data"] as $key => $rows) {
            if (isset($this->container[1]["data"][$key])) {
                foreach ($rows as $first) {
                    foreach ($this->container[1]["data"][$key] as $second) {
                        $this->next(array_merge($first, $second));
                    }
                }
            }
        }
    }
347703
public function onRead()
    {
        $seq = ["\xff\xf4\xff\xfd\x06", "\xff\xec", "\x03", "\x04"];
        $finish = false;
        foreach ($seq as $s) {
            if ($this->search($s) !== false) {
                $finish = true;
            }
        }
        while (($line = $this->readline()) !== null) {
            $line = rtrim($line, "\r\n");
            $e = explode(' ', $line, 2);
            $cmd = trim(strtolower($e[0]));
            $arg = isset($e[1]) ? $e[1] : '';

            if ($cmd === 'quit' || $cmd === 'exit') {
                $this->disconnect();
            } elseif (!$this->auth) {
                $this->checkPassword($line);
            } else {
                $this->processCommand($cmd, $arg);
            }
        }

        if ($finish) {
            $this->finish();
        }
    }
930585
protected function onInput($data)
    {
        //Process data here
        foreach ($this->params as $column) {
            if ($this->character_mask) {
                $data[$column] = trim($data[$column], $this->character_mask);
            } else {
                $data[$column] = trim($data[$column]);
            }
        }
        $this->next($data);
    }
559011
def data_received(self, data):
        """"""
        data = data.decode()
        log.debug('received data: %s', data.strip())
        self.buffer += data
        self.handle_lines()