Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发现bug #10

Closed
fdreamsu opened this issue Sep 27, 2018 · 1 comment
Closed

发现bug #10

fdreamsu opened this issue Sep 27, 2018 · 1 comment
Labels
bug Something isn't working fixed

Comments

@fdreamsu
Copy link
Member

/src/Request.php633行,应为-3,项目中写成了3,部分代码:

    public function recv()
    {
        retry_recv:
        if (self::STATUS_WAITING !== $this->_status) {
            throw new \BadMethodCallException('You can\'t recv because client is not in waiting stat.');
        }
        $this->client->recv($this->getTimeout());
        $this->_status = self::STATUS_NONE;
        $this->_time = microtime(true) - $this->_start_time;

        $is_report = $this->getExceptionReport() & HttpExceptionMask::E_CONNECT;
        $statusCode = $this->client->statusCode;
        $errCode = $this->client->errCode;
        if ($statusCode < 0 || $errCode !== 0) {
            if ($is_report) {
                if ($statusCode === -1) {
                    $message = 'Connect timeout! the server is not listening on the port or the network is missing!';
                } elseif ($statusCode === -2) {
                    $timeout = $this->getTimeout();
                    $message = "Request timeout! the server hasn't responded over the timeout setting({$timeout}s)!";
                } elseif ($statusCode === 3) { //这里写错啦!
                    $message = 'Connection is forcibly cut off by the remote server';
                } else {
                    $message = "Linux Code {$errCode}: " . swoole_strerror($errCode);
                }
                $exception = new ConnectException($this, $statusCode, $message);
                $ret = $this->callInterceptor('exception', $exception);
                if (!$ret) {
                    $this->tryToRevertClientToPool(true);
                    throw $exception;
                }
            } else {
                // Exception is no longer triggered after an exception is ignored
                $this->setExceptionReport(HttpExceptionMask::E_NONE);
            }
        }
@twose
Copy link
Member

twose commented Sep 27, 2018

谢谢提醒, 你可以直接pr修复

@twose twose added the bug Something isn't working label Sep 27, 2018
@twose twose closed this as completed in 106ebe9 Sep 27, 2018
@twose twose added the fixed label Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants