PHPDaemon\Network\IOStream::__construct PHP Method

__construct() public method

IOStream constructor
public __construct ( resource $fd = null, object $pool = null )
$fd resource File descriptor. Optional
$pool object Pool. Optional
    public function __construct($fd = null, $pool = null)
    {
        if ($pool) {
            $this->pool = $pool;
            $this->eventLoop = $pool->eventLoop;
            $this->pool->attach($this);
            if (isset($this->pool->config->timeout->value)) {
                $this->timeout = $this->pool->config->timeout->value;
            }
            if (isset($this->pool->config->timeoutread->value)) {
                $this->timeoutRead = $this->pool->config->timeoutread->value;
            }
            if (isset($this->pool->config->timeoutwrite->value)) {
                $this->timeoutWrite = $this->pool->config->timeoutwrite->value;
            }
        }
        if ($fd !== null) {
            $this->setFd($fd);
        }
        if ($this->EOL === "\n") {
            $this->EOLS = \EventBuffer::EOL_LF;
        } elseif ($this->EOL === "\r\n") {
            $this->EOLS = \EventBuffer::EOL_CRLF;
        } else {
            $this->EOLS = \EventBuffer::EOL_ANY;
        }
        $this->onWriteOnce = new StackCallbacks();
    }