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

$server->close throw a error when swoole set dispatch_func #3362

Closed
GDdark opened this issue Jun 5, 2020 · 0 comments
Closed

$server->close throw a error when swoole set dispatch_func #3362

GDdark opened this issue Jun 5, 2020 · 0 comments

Comments

@GDdark
Copy link

GDdark commented Jun 5, 2020

Error code:

$server = new Swoole\Websocket\Server("0.0.0.0", 9502);

$server->set([
    'dispatch_func' => function ($server, $fd, $type, $data) {
        return 0;
    },
]);

$server->on('open', function($server, $req) {
    $server->close($req->fd);  // bug:trigger a error !!!
});

$server->on('message', function($server, $frame) {
    // nothing
});

$server->on('close', function($server, $fd) {
    echo 'close' . $fd . PHP_EOL; // can not be printed
});

$server->start();

Log:
image

Swoole Version:v4.5.1

twose added a commit that referenced this issue Jun 5, 2020
@matyhtf matyhtf closed this as completed in b604a9c Jun 5, 2020
Yurunsoft pushed a commit to Yurunsoft/swoole-src that referenced this issue Aug 31, 2020
matyhtf added a commit that referenced this issue Sep 1, 2020
* Fix #3362 (#3365)

* Fix #3368 (#3369)

* fix #3367

* Fix typo

Co-authored-by: twosee <twose@qq.com>

* Fix swoole_get_local_mac on OSX (#3372)

# Conflicts:
#	swoole.cc

* fix mysql test case (#3374)

* fix: stop worker in workerStart (#3382)

* fix: stop worker in workerStart

* improvement: add newline at end of file

* Fix missing MySQL transaction error, update the test (#3429)

* fix http client download filename bug (#3489)

* fix http client download filename bug

* fix zend::String()->release()

* Fix #3532 (#3534)

* fix #3532

* improve getHeaderOut()

* add tests
# Conflicts:
#	include/coroutine_socket.h
#	swoole_http_client_coro.cc

* Fixed: fix header inject when use CRLF (#3539)

* fix: fix header inject when use CRLF

* test: add test
# Conflicts:
#	swoole_http_response.cc

* Fixed: Fix  CRLF injection in `redirect` and `header` (#3541)

* Fix CRLF injection in `redirect` and `header`

The previous fix (#3539) was incomplete.
The added check is not enforced when `ucwords` is set to false.

* Fix typo
# Conflicts:
#	swoole_http_response.cc

* Fixed: check cookie injection (#3545)

* Fixed: check cookie injection

* fix: don't check crlf when use cookie urlencode
# Conflicts:
#	swoole_http_response.cc

* Fixed: set coroutine websocket server frame->fd (#3549)

* Fixed: set coroutine websocket server frame->fd

* fix: fix test

* Fix #3577 (#3579)

# Conflicts:
#	swoole_runtime.cc

* Fix the test (#3430)

# Conflicts:
#	tests/swoole_http2_client_coro/post.phpt

* test: fix swoole_http_client_coro/upload_big.phpt (#3590)

* fix: fix http client upload_big test

* fix: http client upload big file

* Fix test

* Fix free

* Fix free

Co-authored-by: twosee <twose@qq.com>
Co-authored-by: 韩天峰-Rango <mikan.tenny@gmail.com>
Co-authored-by: 耐小心 <qiqizjl@qq.com>
Co-authored-by: codinghuang <2812240764@qq.com>
Co-authored-by: Jiantao Li <CurseRed@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant