├── .clang-format ├── .editorconfig ├── .gitattributes ├── .gitignore ├── CMakeLists.txt ├── Dockerfile ├── LICENSE ├── Makefile.frag ├── README.md ├── codecov.yml ├── composer.json ├── config.m4 ├── docs ├── CHANGELOG.md ├── CODE-STYLE.md ├── CPPLINT.cfg ├── ISSUE.md ├── SUPPORTED.md ├── TESTS.md ├── WORKFLOW-PARAMETERS.md ├── google-style.xml ├── sponsors.md └── swoole-logo.svg ├── examples ├── atomic │ ├── long.php │ ├── test.php │ └── wait.php ├── client │ ├── c10k.php │ ├── get_socket.php │ ├── long_tcp.php │ ├── recv_1m.php │ ├── recv_file.php │ ├── select.php │ ├── simple.php │ ├── sync.php │ ├── test.txt │ └── udp_sync.php ├── coroutine │ ├── backtrace.php │ ├── before_server_start.php │ ├── behavior │ │ ├── do-while.php │ │ ├── for.php │ │ ├── foreach.php │ │ ├── goto.php │ │ ├── preemptive_timer.php │ │ ├── tick.php │ │ ├── while.php │ │ └── while2.php │ ├── channel │ │ └── test.php │ ├── client_send_yield.php │ ├── client_send_yield_server.php │ ├── coro_array_map.php │ ├── coro_call_user.php │ ├── coro_channel.php │ ├── coro_destruct.php │ ├── coro_destuct.php │ ├── coro_empty.php │ ├── coro_gethost.php │ ├── coro_include.php │ ├── coro_invoke.php │ ├── coro_nested.php │ ├── coro_nested_empty.php │ ├── coro_serialize.php │ ├── coro_set_stack_size.php │ ├── coro_sleep.php │ ├── coro_stackless.php │ ├── coro_util.php │ ├── csp.php │ ├── deadlock.php │ ├── defer.php │ ├── defer_client.php │ ├── enable_coroutine.php │ ├── exception │ │ └── empty.php │ ├── exec.php │ ├── exit_in_coroutine.php │ ├── exit_with_status.php │ ├── fgets.php │ ├── fread.php │ ├── fwrite.php │ ├── gethostbyname.php │ ├── http │ │ ├── server.php │ │ └── write_func.php │ ├── http2_client.php │ ├── http_backend_serv.php │ ├── http_client.php │ ├── http_download.php │ ├── http_server.php │ ├── httpmulti.php │ ├── join.php │ ├── library │ │ └── base.php │ ├── list_coroutines.php │ ├── mysql_chan.php │ ├── mysql_escape.php │ ├── mysql_execute_empty.php │ ├── mysql_prepare.php │ ├── mysql_prepare_2.php │ ├── mysql_procedure_exec.php │ ├── mysql_query.php │ ├── mysql_unixsocket.php │ ├── pdo │ │ └── pdo_persistent.phpt │ ├── proc_open.php │ ├── reconnect_test.php │ ├── redis │ │ ├── auth.php │ │ ├── defer.php │ │ ├── eval.php │ │ ├── get.php │ │ ├── multi.php │ │ ├── pipeline.php │ │ ├── pub.php │ │ ├── request.php │ │ ├── serialize.php │ │ └── sub.php │ ├── redis_pool.php │ ├── redis_subscribe.php │ ├── scheduler.php │ ├── select │ │ ├── 1.php │ │ ├── 2.php │ │ ├── 3.php │ │ ├── 4.php │ │ ├── 5.php │ │ ├── 6.php │ │ ├── 7.php │ │ ├── 8.php │ │ ├── 9.php │ │ ├── poptimeout.php │ │ └── test.php │ ├── send_yield.php │ ├── send_yield_client.php │ ├── server │ │ └── tcp.php │ ├── sleep.php │ ├── socket │ │ ├── accept.php │ │ └── sendto.php │ ├── stack.php │ ├── stack │ │ ├── 1.php │ │ └── 2.php │ ├── statvfs.php │ ├── task_co.php │ ├── tcp_backend_serv.php │ ├── tcp_echo.php │ ├── test.php │ ├── timer_test.php │ ├── udp_client.php │ ├── udp_tcp_timeout.php │ ├── user_coroutine.php │ ├── util │ │ ├── resume001.php │ │ ├── resume002.php │ │ └── resume003.php │ ├── waitgroup.php │ └── websocket │ │ ├── client.php │ │ ├── co_server.php │ │ └── server.php ├── cpp │ ├── Makefile │ ├── co.cc │ ├── repeat.cc │ └── test_server.cc ├── curl │ ├── hook.php │ ├── multi.php │ └── server.php ├── dtls │ ├── client.php │ └── server.php ├── eof │ ├── client.php │ └── server.php ├── event │ ├── cycle.php │ ├── inotify.php │ ├── sockets.php │ ├── stdin.php │ ├── stream.php │ └── test.php ├── http │ ├── UPPER.TXT │ ├── client.php │ ├── curl.php │ ├── detach.php │ ├── download.php │ ├── empty.txt │ ├── event-stream.php │ ├── moc.moc │ ├── no-compression.php │ ├── post.data │ ├── raw.php │ ├── redirect.php │ ├── server.php │ ├── static_handler.php │ └── test.txt ├── http2 │ ├── server.php │ ├── streaming.php │ └── test.html ├── ipv6 │ ├── tcp_client.php │ ├── tcp_server.php │ ├── udp_client.php │ └── udp_server.php ├── length │ ├── client.php │ ├── config.php │ ├── func.php │ └── server.php ├── lock │ └── lock.php ├── misc │ ├── get_local_ip.php │ └── version.php ├── multicast │ ├── client.php │ └── server.php ├── php │ ├── buf_size.php │ ├── debug_server.php │ ├── error.php │ ├── exception.php │ ├── func.php │ ├── inotify.php │ ├── proc.php │ ├── socket_client.php │ ├── socket_server.php │ ├── stream_client.php │ ├── stream_server.php │ └── tick.php ├── postgresql │ └── postgresql_coro.php ├── process │ ├── alarm.php │ ├── async_master.php │ ├── client.php │ ├── client3.php │ ├── close.php │ ├── daemon.php │ ├── echo.py │ ├── exec.php │ ├── func_timeout.php │ ├── msg_pop.php │ ├── msg_push.php │ ├── msgqueue.php │ ├── msgqueue2.php │ ├── msgqueue_client.php │ ├── msgqueue_pool.php │ ├── pool_socket.php │ ├── python.php │ ├── select.php │ ├── set_cpu_affinity.php │ ├── stdin_stdout.php │ ├── test.php │ └── worker.php ├── process_pool │ ├── detach.php │ └── send.php ├── runtime │ ├── coroutine.php │ ├── curl.php │ ├── file.php │ ├── gethostbyname.php │ ├── include.php │ ├── mkdir.php │ ├── oci.php │ ├── odbc.php │ ├── read.php │ ├── rename.phpt │ ├── select.php │ ├── sleep.php │ ├── sqlite.php │ ├── ssl.php │ ├── stream.php │ ├── sync.php │ ├── time_sleep_until.php │ └── unlink.phpt ├── server │ ├── db_pool.php │ ├── dispatch_func.php │ ├── dispatch_stream.php │ ├── echo.php │ ├── eof_client.php │ ├── eof_server.php │ ├── getReceivedTime.php │ ├── host_update.php │ ├── hot_update_class.php │ ├── ip_dispatch.php │ ├── length_client.php │ ├── length_server.php │ ├── listen_1k_port.php │ ├── local_listener.php │ ├── manager_timer.php │ ├── mixed.php │ ├── multi_instance.php │ ├── multi_port.php │ ├── pipe_message.php │ ├── proxy_sync.php │ ├── redis_pool.php │ ├── reload_aysnc.php │ ├── reload_force.php │ ├── reload_force2.php │ ├── send_1m.php │ ├── sendfile.php │ ├── single.php │ ├── tcp_client.php │ ├── tcp_server.php │ ├── trace.php │ ├── uid_dispatch.php │ ├── unix_stream.php │ └── zmq.php ├── socket_coro │ ├── client.php │ ├── server.php │ └── udp.php ├── ssl │ ├── ca │ │ ├── ca-cert.pem │ │ ├── ca-key.pem │ │ ├── ca-req.csr │ │ ├── client-cert.pem │ │ ├── client-key.pem │ │ ├── client-req.csr │ │ ├── client.crt │ │ ├── client.key │ │ ├── server-cert.pem │ │ ├── server-key.pem │ │ └── server-req.csr │ ├── client.c │ ├── client.php │ ├── co_client.php │ ├── gen_cert.md │ ├── http_client.php │ ├── passphrase.php │ ├── server.php │ ├── ssl.crt │ ├── ssl.csr │ ├── ssl.key │ ├── ssl_passwd │ │ ├── ssl.crt │ │ ├── ssl.csr │ │ └── ssl.key │ ├── stream_client.php │ ├── swoole.log │ ├── webserver.php │ ├── websocket_client.html │ └── websocket_server.php ├── table │ ├── deadlock.php │ ├── iterator.php │ ├── server.php │ ├── set.php │ ├── simulation.php │ └── usage.php ├── task │ ├── http.php │ ├── msg_push.php │ ├── shared_client.php │ ├── shared_server.php │ ├── task.php │ ├── task_coro.php │ ├── task_num.php │ ├── task_queue.php │ └── task_stream.php ├── test.jpg ├── thread │ ├── aio.php │ ├── argv.php │ ├── array.php │ ├── atomic.php │ ├── benchmark.php │ ├── co.php │ ├── exit.php │ ├── hook.php │ ├── lock.php │ ├── map.php │ ├── mt.php │ ├── nested_map.php │ ├── pipe.php │ ├── run_test.php │ ├── server.php │ ├── signal.php │ ├── socket.php │ ├── test.php │ ├── thread_pool.php │ └── thread_server.php ├── timer │ ├── after.php │ ├── clear.php │ ├── enable_coroutine.php │ └── tick.php ├── udp │ ├── client.php │ └── server.php ├── unixsock │ ├── dgram_client.php │ ├── dgram_server.php │ ├── stream_client.php │ └── stream_server.php ├── websocket │ ├── client.html │ ├── client.php │ └── server.php └── www │ ├── dir1 │ ├── file1.txt │ └── file2.txt │ ├── dir2 │ ├── file1.txt │ ├── file2.txt │ └── index.txt │ ├── file1.txt │ ├── file2.txt │ ├── index.html │ └── index.txt ├── ext-src ├── php_swoole.cc ├── php_swoole_call_stack.h ├── php_swoole_client.h ├── php_swoole_coroutine.h ├── php_swoole_coroutine_system.h ├── php_swoole_curl.h ├── php_swoole_cxx.cc ├── php_swoole_cxx.h ├── php_swoole_http.h ├── php_swoole_http_server.h ├── php_swoole_library.h ├── php_swoole_odbc.h ├── php_swoole_oracle.h ├── php_swoole_pgsql.h ├── php_swoole_private.h ├── php_swoole_process.h ├── php_swoole_server.h ├── php_swoole_sqlite.h ├── php_swoole_thread.h ├── stubs │ ├── php_swoole.stub.php │ ├── php_swoole_arginfo.h │ ├── php_swoole_atomic.stub.php │ ├── php_swoole_atomic_arginfo.h │ ├── php_swoole_channel_coro.stub.php │ ├── php_swoole_channel_coro_arginfo.h │ ├── php_swoole_client.stub.php │ ├── php_swoole_client_arginfo.h │ ├── php_swoole_client_async.stub.php │ ├── php_swoole_client_async_arginfo.h │ ├── php_swoole_client_coro.stub.php │ ├── php_swoole_client_coro_arginfo.h │ ├── php_swoole_coroutine.stub.php │ ├── php_swoole_coroutine_arginfo.h │ ├── php_swoole_coroutine_lock.stub.php │ ├── php_swoole_coroutine_lock_arginfo.h │ ├── php_swoole_coroutine_scheduler.stub.php │ ├── php_swoole_coroutine_scheduler_arginfo.h │ ├── php_swoole_coroutine_system.stub.php │ ├── php_swoole_coroutine_system_arginfo.h │ ├── php_swoole_event.stub.php │ ├── php_swoole_event_arginfo.h │ ├── php_swoole_ex.stub.php │ ├── php_swoole_ex_arginfo.h │ ├── php_swoole_http2_client_coro.stub.php │ ├── php_swoole_http2_client_coro_arginfo.h │ ├── php_swoole_http_client_coro.stub.php │ ├── php_swoole_http_client_coro_arginfo.h │ ├── php_swoole_http_cookie.stub.php │ ├── php_swoole_http_cookie_arginfo.h │ ├── php_swoole_http_request.stub.php │ ├── php_swoole_http_request_arginfo.h │ ├── php_swoole_http_response.stub.php │ ├── php_swoole_http_response_arginfo.h │ ├── php_swoole_http_server_coro.stub.php │ ├── php_swoole_http_server_coro_arginfo.h │ ├── php_swoole_lock.stub.php │ ├── php_swoole_lock_arginfo.h │ ├── php_swoole_name_resolver.stub.php │ ├── php_swoole_name_resolver_arginfo.h │ ├── php_swoole_process.stub.php │ ├── php_swoole_process_arginfo.h │ ├── php_swoole_process_pool.stub.php │ ├── php_swoole_process_pool_arginfo.h │ ├── php_swoole_redis_server.stub.php │ ├── php_swoole_redis_server_arginfo.h │ ├── php_swoole_runtime.stub.php │ ├── php_swoole_runtime_arginfo.h │ ├── php_swoole_server.stub.php │ ├── php_swoole_server_arginfo.h │ ├── php_swoole_server_port.stub.php │ ├── php_swoole_server_port_arginfo.h │ ├── php_swoole_socket_coro.stub.php │ ├── php_swoole_socket_coro_arginfo.h │ ├── php_swoole_table.stub.php │ ├── php_swoole_table_arginfo.h │ ├── php_swoole_thread.stub.php │ ├── php_swoole_thread_arginfo.h │ ├── php_swoole_thread_arraylist.stub.php │ ├── php_swoole_thread_arraylist_arginfo.h │ ├── php_swoole_thread_atomic.stub.php │ ├── php_swoole_thread_atomic_arginfo.h │ ├── php_swoole_thread_barrier.stub.php │ ├── php_swoole_thread_barrier_arginfo.h │ ├── php_swoole_thread_lock.stub.php │ ├── php_swoole_thread_lock_arginfo.h │ ├── php_swoole_thread_map.stub.php │ ├── php_swoole_thread_map_arginfo.h │ ├── php_swoole_thread_queue.stub.php │ ├── php_swoole_thread_queue_arginfo.h │ ├── php_swoole_timer.stub.php │ ├── php_swoole_timer_arginfo.h │ ├── php_swoole_websocket.stub.php │ └── php_swoole_websocket_arginfo.h ├── swoole_admin_server.cc ├── swoole_async_coro.cc ├── swoole_atomic.cc ├── swoole_channel_coro.cc ├── swoole_client.cc ├── swoole_client_async.cc ├── swoole_client_coro.cc ├── swoole_coroutine.cc ├── swoole_coroutine_lock.cc ├── swoole_coroutine_scheduler.cc ├── swoole_coroutine_system.cc ├── swoole_curl.cc ├── swoole_curl_interface.h ├── swoole_event.cc ├── swoole_http2_client_coro.cc ├── swoole_http2_server.cc ├── swoole_http_client_coro.cc ├── swoole_http_cookie.cc ├── swoole_http_request.cc ├── swoole_http_response.cc ├── swoole_http_server.cc ├── swoole_http_server_coro.cc ├── swoole_lock.cc ├── swoole_name_resolver.cc ├── swoole_odbc.cc ├── swoole_oracle.cc ├── swoole_pgsql.cc ├── swoole_process.cc ├── swoole_process_pool.cc ├── swoole_redis_server.cc ├── swoole_runtime.cc ├── swoole_server.cc ├── swoole_server_port.cc ├── swoole_socket_coro.cc ├── swoole_sqlite.cc ├── swoole_table.cc ├── swoole_thread.cc ├── swoole_thread_arraylist.cc ├── swoole_thread_atomic.cc ├── swoole_thread_barrier.cc ├── swoole_thread_lock.cc ├── swoole_thread_map.cc ├── swoole_thread_queue.cc ├── swoole_timer.cc └── swoole_websocket_server.cc ├── gdbinit ├── include ├── helper │ └── kqueue.h ├── swoole.h ├── swoole_api.h ├── swoole_asm_context.h ├── swoole_async.h ├── swoole_atomic.h ├── swoole_base64.h ├── swoole_buffer.h ├── swoole_c_api.h ├── swoole_channel.h ├── swoole_client.h ├── swoole_config.h ├── swoole_coroutine.h ├── swoole_coroutine_c_api.h ├── swoole_coroutine_channel.h ├── swoole_coroutine_context.h ├── swoole_coroutine_socket.h ├── swoole_coroutine_system.h ├── swoole_dtls.h ├── swoole_error.h ├── swoole_file.h ├── swoole_file_hook.h ├── swoole_hash.h ├── swoole_heap.h ├── swoole_http.h ├── swoole_http2.h ├── swoole_iouring.h ├── swoole_lock.h ├── swoole_log.h ├── swoole_lru_cache.h ├── swoole_memory.h ├── swoole_message_bus.h ├── swoole_mime_type.h ├── swoole_mqtt.h ├── swoole_msg_queue.h ├── swoole_pipe.h ├── swoole_process_pool.h ├── swoole_protocol.h ├── swoole_proxy.h ├── swoole_reactor.h ├── swoole_redis.h ├── swoole_server.h ├── swoole_signal.h ├── swoole_socket.h ├── swoole_socket_hook.h ├── swoole_ssl.h ├── swoole_static_handler.h ├── swoole_string.h ├── swoole_table.h ├── swoole_thread.h ├── swoole_timer.h ├── swoole_util.h ├── swoole_version.h └── swoole_websocket.h ├── package.xml ├── php_swoole.h ├── run-core-tests.sh ├── scripts ├── .gitignore ├── clear.sh ├── code-format.sh ├── code-stats.sh ├── debug │ ├── swoole_info.php │ └── swoole_table_implements.php ├── docker-compile-with-iouring.sh ├── docker-compile-with-thread.sh ├── docker-compile.sh ├── docker-compose.yml ├── docker-iouring-route.sh ├── docker-route.sh ├── docker-thread-route.sh ├── format-changed-files.sh ├── install-deps-on-ubuntu.sh ├── library.sh ├── make.sh ├── pecl-install.sh ├── rename.php ├── route.sh ├── run-tests.sh ├── simple-compile-on-github.sh └── simple-compile.sh ├── src ├── core │ ├── base.cc │ ├── base64.cc │ ├── channel.cc │ ├── crc32.cc │ ├── error.cc │ ├── heap.cc │ ├── log.cc │ ├── misc.cc │ ├── string.cc │ └── timer.cc ├── coroutine │ ├── base.cc │ ├── channel.cc │ ├── context.cc │ ├── file_lock.cc │ ├── hook.cc │ ├── iouring.cc │ ├── socket.cc │ ├── system.cc │ └── thread_context.cc ├── lock │ ├── barrier.cc │ ├── coroutine_lock.cc │ ├── mutex.cc │ ├── rw_lock.cc │ └── spin_lock.cc ├── memory │ ├── buffer.cc │ ├── fixed_pool.cc │ ├── global_memory.cc │ ├── ring_buffer.cc │ ├── shared_memory.cc │ └── table.cc ├── network │ ├── address.cc │ ├── client.cc │ ├── dns.cc │ ├── socket.cc │ └── stream.cc ├── os │ ├── async_thread.cc │ ├── base.cc │ ├── file.cc │ ├── msg_queue.cc │ ├── pipe.cc │ ├── process_pool.cc │ ├── sendfile.cc │ ├── signal.cc │ ├── timer.cc │ ├── unix_socket.cc │ └── wait.cc ├── protocol │ ├── base.cc │ ├── dtls.cc │ ├── http.cc │ ├── http2.cc │ ├── message_bus.cc │ ├── mime_type.cc │ ├── mqtt.cc │ ├── redis.cc │ ├── socks5.cc │ ├── ssl.cc │ └── websocket.cc ├── reactor │ ├── base.cc │ ├── epoll.cc │ ├── kqueue.cc │ └── poll.cc ├── server │ ├── base.cc │ ├── manager.cc │ ├── master.cc │ ├── port.cc │ ├── process.cc │ ├── reactor_process.cc │ ├── reactor_thread.cc │ ├── static_handler.cc │ ├── task_worker.cc │ ├── thread.cc │ └── worker.cc └── wrapper │ ├── event.cc │ ├── http.cc │ └── timer.cc ├── tests ├── .php-cs-fixer.dist.php ├── CONTRIBUTION ├── README.md ├── clean ├── include │ ├── api │ │ ├── curl_multi.php │ │ ├── exit.php │ │ ├── http_server.php │ │ ├── http_test_cases.php │ │ ├── swoole_callback │ │ │ └── swoole_cannot_destroy_active_lambda_function.php │ │ ├── swoole_client │ │ │ ├── connect_timeout.php │ │ │ ├── connect_twice.php │ │ │ ├── http_get.php │ │ │ ├── opcode_client.php │ │ │ ├── simple_client.php │ │ │ └── socket_free.php │ │ ├── swoole_http_server │ │ │ ├── http_server.php │ │ │ ├── http_server_without_response.php │ │ │ ├── simple_http_server.php │ │ │ └── simple_https_server.php │ │ ├── swoole_server │ │ │ ├── TestServer.php │ │ │ ├── multi_protocol_server.php │ │ │ ├── opcode_server.php │ │ │ ├── reconnect_fail │ │ │ │ ├── tcp_client.php │ │ │ │ └── tcp_serv.php │ │ │ ├── server_manager_process_exit.php │ │ │ ├── server_send_fast_recv_slow.php │ │ │ ├── simple_server.php │ │ │ ├── simple_tcp_server.php │ │ │ ├── simple_udp_server.php │ │ │ ├── tcp_serv.php │ │ │ ├── tcp_task_server.php │ │ │ └── testsendfile.txt │ │ ├── swoole_thread │ │ │ ├── putenv.php │ │ │ └── sleep.php │ │ ├── swoole_timer │ │ │ ├── accurate_test.php │ │ │ ├── fixRate_vs_fixDelay.php │ │ │ ├── invalid_args.php │ │ │ ├── multi_timer.php │ │ │ └── register_shutdown_priority.php │ │ ├── swoole_websocket_server │ │ │ ├── send_large_request_data.php │ │ │ ├── send_small_request_data.php │ │ │ ├── swoole_websocket_server.php │ │ │ └── websocket_client.php │ │ ├── syntax_error.txt │ │ ├── tcp_server.php │ │ └── test_classes │ │ │ ├── A.php │ │ │ ├── A2.php │ │ │ └── B.php │ ├── bootstrap.php │ ├── config.php │ ├── functions.php │ ├── lib │ │ ├── composer.json │ │ └── src │ │ │ ├── Assert.php │ │ │ ├── ChildProcess.php │ │ │ ├── CoServer.php │ │ │ ├── CurlManager.php │ │ │ ├── DbWrapper.php │ │ │ ├── LengthServer.php │ │ │ ├── MQTT │ │ │ └── Helper.php │ │ │ ├── MysqlPool.php │ │ │ ├── ProcessManager.php │ │ │ ├── RandStr.php │ │ │ ├── Redis │ │ │ ├── DBConnectException.php │ │ │ ├── Lock.php │ │ │ ├── Redis.php │ │ │ └── SQLPool.php │ │ │ ├── Samtleben │ │ │ └── WebsocketClient.php │ │ │ ├── ServerManager.php │ │ │ ├── TcpStat.php │ │ │ ├── ThreadManager.php │ │ │ ├── WaitRef.php │ │ │ └── responder │ │ │ └── get.php │ ├── macos │ │ └── phpstorm.py │ ├── skipif.inc │ └── ssl_certs │ │ ├── ca-cert.pem │ │ ├── ca-key.pem │ │ ├── ca-req.csr │ │ ├── ca.crt │ │ ├── ca.csr │ │ ├── ca.key │ │ ├── ca.srl │ │ ├── client-cert.pem │ │ ├── client-expired.crt │ │ ├── client-expired.csr │ │ ├── client-expired.key │ │ ├── client-key.pem │ │ ├── client-req.csr │ │ ├── client.crt │ │ ├── client.csr │ │ ├── client.key │ │ ├── client.pem │ │ ├── dhparams.pem │ │ ├── mosquitto.org.crt │ │ ├── passwd.crt │ │ ├── passwd_key.pem │ │ ├── server-cert.pem │ │ ├── server-key.pem │ │ ├── server-req.csr │ │ ├── server.crt │ │ ├── server.csr │ │ ├── server.key │ │ ├── server.pem │ │ ├── sni_server_ca.pem │ │ ├── sni_server_cs.pem │ │ ├── sni_server_cs_cert.pem │ │ ├── sni_server_cs_key.pem │ │ ├── sni_server_uk.pem │ │ ├── sni_server_uk_cert.pem │ │ ├── sni_server_uk_key.pem │ │ ├── sni_server_us.pem │ │ ├── sni_server_us_cert.pem │ │ └── sni_server_us_key.pem ├── init ├── new ├── pgsql.sql ├── php-cs-fixer ├── run-tests ├── start.sh ├── swoole_atomic │ ├── atomic.phpt │ ├── dtor_in_child.phpt │ ├── multi_wakeup.phpt │ ├── wait.phpt │ ├── wait_and_wakeup.phpt │ └── wait_ex.phpt ├── swoole_channel_coro │ ├── 1.phpt │ ├── 10.phpt │ ├── 2.phpt │ ├── 3.phpt │ ├── 4.phpt │ ├── 5.phpt │ ├── 6.phpt │ ├── 7.phpt │ ├── 8.phpt │ ├── 9.phpt │ ├── basic.phpt │ ├── benchmark.phpt │ ├── blocking_timeout.phpt │ ├── bug_1947.phpt │ ├── bug_clear_timer.phpt │ ├── chan_select_timeout.phpt │ ├── chan_stats.phpt │ ├── close.phpt │ ├── coro_wait.phpt │ ├── discard.phpt │ ├── fibonacci.phpt │ ├── http2.phpt │ ├── hybird_chan.phpt │ ├── hybird_chan2.phpt │ ├── hybird_chan3.phpt │ ├── lock.phpt │ ├── no_ctor.phpt │ ├── pool.phpt │ ├── pop_after_close.phpt │ ├── pop_close1.phpt │ ├── pop_timeout1.phpt │ ├── pop_timeout2.phpt │ ├── pop_timeout3.phpt │ ├── pop_timeout4.phpt │ ├── pop_timeout5.phpt │ ├── pop_timeout6.phpt │ ├── pop_timeout7.phpt │ ├── pop_timeout8.phpt │ ├── push_close1.phpt │ ├── push_timeout1.phpt │ ├── push_timeout2.phpt │ ├── push_timeout3.phpt │ ├── push_timeout4.phpt │ └── type.phpt ├── swoole_client_async │ ├── base.phpt │ ├── big_package_memory_leak.phpt │ ├── buffer_full.phpt │ ├── connect_dns.phpt │ ├── connect_refuse.phpt │ ├── connect_refuse_udg.phpt │ ├── connect_refuse_unix.phpt │ ├── connect_timeout.phpt │ ├── connect_twice.phpt │ ├── enableSSL.phpt │ ├── enableSSL_bad_callback.phpt │ ├── enableSSL_before_connect.phpt │ ├── eof.phpt │ ├── eof_close.phpt │ ├── getSocket_bug.phpt │ ├── getpeername.phpt │ ├── getsockname.phpt │ ├── length_protocol.phpt │ ├── length_protocol_func.phpt │ ├── port_invalid.phpt │ ├── sendfile.phpt │ └── sleep_wake.phpt ├── swoole_client_coro │ ├── bug_2346.phpt │ ├── close.phpt │ ├── close_in_other_co.phpt │ ├── close_resume.phpt │ ├── close_socket_property.phpt │ ├── close_twice.phpt │ ├── connect_dns_timeout.phpt │ ├── connect_timeout.phpt │ ├── connect_with_dns.phpt │ ├── dtls.phpt │ ├── enableSSL.phpt │ ├── eof.phpt │ ├── eof_02.phpt │ ├── eof_03.phpt │ ├── eof_04.phpt │ ├── export_socket.phpt │ ├── fixed_package.phpt │ ├── getpeername.phpt │ ├── getsockname.phpt │ ├── isConnected.phpt │ ├── length_01.phpt │ ├── length_02.phpt │ ├── length_03.phpt │ ├── length_04.phpt │ ├── length_protocol_func.phpt │ ├── length_types.phpt │ ├── read_and_write.phpt │ ├── reconnect.phpt │ ├── reconnect_2.phpt │ ├── reconnect_3.phpt │ ├── recv_after_close.phpt │ ├── recv_bad_packet.phpt │ ├── recv_timeout.phpt │ ├── recv_timeout2.phpt │ ├── recvfrom.phpt │ ├── recvfrom_2.phpt │ ├── recvfrom_timeout.phpt │ ├── recvfrom_timeout2.phpt │ ├── send_big.phpt │ ├── sendfile.phpt │ ├── sendto.phpt │ ├── ssl.phpt │ ├── ssl_verify.phpt │ ├── tcp_client.phpt │ ├── tcp_nodelay.phpt │ ├── timeout.phpt │ ├── udp_client.phpt │ ├── udp_recv_failed.phpt │ ├── unsock_dgram.phpt │ └── unsock_stream.phpt ├── swoole_client_sync │ ├── bind_address.phpt │ ├── connect_1.phpt │ ├── connect_2.phpt │ ├── connect_3.phpt │ ├── enableSSL.phpt │ ├── enableSSL_2.phpt │ ├── eof.phpt │ ├── eof_close.phpt │ ├── eof_timeout.phpt │ ├── http_proxy.phpt │ ├── keep1.phpt │ ├── keep2.phpt │ ├── keep3.phpt │ ├── keep4.phpt │ ├── keep5.phpt │ ├── keep6.phpt │ ├── length_protocol.phpt │ ├── length_protocol_02.phpt │ ├── length_protocol_func.phpt │ ├── recv_in_task.phpt │ ├── recv_timeout.phpt │ ├── recv_with_open_eof_check.phpt │ ├── select.phpt │ ├── select_null.phpt │ ├── send_recv.phpt │ ├── sendfile.phpt │ ├── sendto.phpt │ ├── socks5_proxy.phpt │ ├── ssl_recv_timeout.phpt │ ├── sync_send_recv.phpt │ ├── udg_send_timeout.phpt │ └── udp_client_sendto.phpt ├── swoole_coroutine │ ├── after_start_server_1.phpt │ ├── all_asleep.phpt │ ├── array_walk.phpt │ ├── array_walk_deep.phpt │ ├── async_callback │ │ ├── event_cycle.phpt │ │ ├── signal.phpt │ │ └── timer.phpt │ ├── autoload.phpt │ ├── autoload_not_found.phpt │ ├── autoload_not_found_not_in_coroutine.phpt │ ├── autoload_not_in_coroutine.phpt │ ├── bailout │ │ ├── co_redis_in_shutdown_function.phpt │ │ ├── error.phpt │ │ ├── error_in.phpt │ │ ├── error_internal.phpt │ │ ├── error_internal2.phpt │ │ ├── error_out.phpt │ │ └── exit.phpt │ ├── before_create_server_1.phpt │ ├── before_create_server_2.phpt │ ├── before_create_server_3.phpt │ ├── bug_2387.phpt │ ├── bug_5699.phpt │ ├── c_stack_size.phpt │ ├── call_not_exists_func.phpt │ ├── call_user_func_array.phpt │ ├── call_user_func_array2.phpt │ ├── call_with_args.phpt │ ├── callback.phpt │ ├── cancel │ │ ├── channel_pop.phpt │ │ ├── channel_push.phpt │ │ ├── error.phpt │ │ ├── gethostbyname.phpt │ │ ├── sleep.phpt │ │ ├── socket.phpt │ │ ├── suspend.phpt │ │ ├── wait.phpt │ │ ├── wait_event.phpt │ │ └── wait_signal.phpt │ ├── check.phpt │ ├── cid.phpt │ ├── create_after_rshutdown.phpt │ ├── current.phpt │ ├── dead_lock.phpt │ ├── defer │ │ ├── defer.phpt │ │ ├── defer_close.phpt │ │ ├── defer_exception.phpt │ │ └── defer_in_try.phpt │ ├── destruct │ │ ├── destruct1.phpt │ │ ├── destruct2.phpt │ │ └── destruct3.phpt │ ├── dnslookup_1.phpt │ ├── dnslookup_2.phpt │ ├── dnslookup_3.phpt │ ├── dnslookup_4.phpt │ ├── dnslookup_5.phpt │ ├── dnslookup_ipv6.phpt │ ├── dnslookup_query_hosts.phpt │ ├── empty.phpt │ ├── eval.phpt │ ├── exception.phpt │ ├── exception │ │ ├── core_error.phpt │ │ ├── defer1.phpt │ │ ├── defer2.phpt │ │ ├── dtor.phpt │ │ ├── empty.phpt │ │ ├── error.phpt │ │ ├── error1.phpt │ │ ├── error2.phpt │ │ ├── error3.phpt │ │ ├── fatal_error.phpt │ │ ├── nested.phpt │ │ ├── yield.phpt │ │ └── yield1.phpt │ ├── execute_time.phpt │ ├── exists.phpt │ ├── exit.phpt │ ├── exit_84.phpt │ ├── exit_exception_backtrace.phpt │ ├── exit_exception_backtrace_84.phpt │ ├── fatal_error.phpt │ ├── forbidden_case │ │ ├── array_map.phpt │ │ ├── call_user.phpt │ │ └── invoke.phpt │ ├── getContext.phpt │ ├── getElasped.phpt │ ├── getPcid.phpt │ ├── getPcid_by_random_cid.phpt.phpt │ ├── gethostbyname.phpt │ ├── iterator.phpt │ ├── join │ │ ├── 1.phpt │ │ ├── 2.phpt │ │ ├── 3.phpt │ │ ├── 4.phpt │ │ ├── 5.phpt │ │ ├── 6.phpt │ │ ├── 7.phpt │ │ └── 8.phpt │ ├── kernel_coroutine.phpt │ ├── list_and_backtrace.phpt │ ├── max_num.phpt │ ├── max_num_limit.phpt │ ├── nested1.phpt │ ├── nested2.phpt │ ├── nested3.phpt │ ├── nested_empty.phpt │ ├── nested_uid.phpt │ ├── new_process.phpt │ ├── new_server.phpt │ ├── no_inline_func.phpt │ ├── output │ │ ├── create.phpt │ │ ├── in_nested_co.phpt │ │ ├── ob_main.phpt │ │ └── output_control.phpt │ ├── parallel1.phpt │ ├── parallel2.phpt │ ├── parallel3.phpt │ ├── pdo_error_handing.phpt │ ├── private_access.phpt │ ├── resume_loop.phpt │ ├── scheduler.phpt │ ├── signal_listener.phpt │ ├── stats.phpt │ ├── use_process.phpt │ ├── user_coroutine.phpt │ └── user_coroutine_2.phpt ├── swoole_coroutine_lock │ ├── lock.phpt │ ├── trylock.phpt │ └── trylock2.phpt ├── swoole_coroutine_scheduler │ ├── getOptions.phpt │ ├── hook_flags.phpt │ ├── hook_flags_2.phpt │ ├── parallel.phpt │ ├── preemptive │ │ ├── disable.phpt │ │ ├── disable2.phpt │ │ ├── do-while.phpt │ │ ├── do-while2.phpt │ │ ├── do-while3.phpt │ │ ├── for.phpt │ │ ├── for2.phpt │ │ ├── goto.phpt │ │ ├── goto2.phpt │ │ ├── timer.phpt │ │ ├── while.phpt │ │ ├── while2.phpt │ │ └── while3.phpt │ ├── repeat.phpt │ ├── resume1.phpt │ ├── resume2.phpt │ ├── resume3.phpt │ ├── resume4.phpt │ ├── resume5.phpt │ ├── resume6.phpt │ ├── start.phpt │ ├── start_in_server_shutdown.phpt │ └── start_in_server_worker_stop.phpt ├── swoole_coroutine_system │ ├── aio_thread_num.phpt │ ├── getaddrinfo.phpt │ ├── getaddrinfo_timeout.phpt │ ├── gethostbyname.phpt │ ├── gethostbyname_ipv6.phpt │ ├── gethostbyname_timeout.phpt │ ├── readfile.phpt │ ├── sleep.phpt │ ├── wait.phpt │ ├── waitEvent.phpt │ ├── waitPid.phpt │ ├── waitSignal.phpt │ ├── waitSignal_2.phpt │ ├── writefile.phpt │ └── writefile_append.phpt ├── swoole_coroutine_util │ ├── dns_lookup.phpt │ ├── exec.phpt │ ├── exec_sleep.phpt │ ├── fgets.phpt │ ├── fread.phpt │ ├── fwrite.phpt │ ├── list_coroutine.phpt │ └── task_worker.phpt ├── swoole_coroutine_wait_group │ ├── base.phpt │ ├── defer.phpt │ ├── empty.phpt │ └── logic.phpt ├── swoole_curl │ ├── abnormal_response │ │ ├── 1.phpt │ │ └── 2.phpt │ ├── basic │ │ ├── 1.phpt │ │ ├── 10.phpt │ │ ├── 11.phpt │ │ ├── 12.phpt │ │ ├── 13.phpt │ │ ├── 14.phpt │ │ ├── 15.phpt │ │ ├── 19.phpt │ │ ├── 2.phpt │ │ ├── 20.phpt │ │ ├── 21.phpt │ │ ├── 22.phpt │ │ ├── 23.phpt │ │ ├── 24.phpt │ │ ├── 25.phpt │ │ ├── 3.phpt │ │ ├── 4.phpt │ │ ├── 5.phpt │ │ ├── 7.phpt │ │ ├── 8.phpt │ │ └── 9.phpt │ ├── cancel.phpt │ ├── close_before_resume.phpt │ ├── concurrent.phpt │ ├── error.phpt │ ├── event_exit.phpt │ ├── exec_twice.phpt │ ├── fatal_error_in_callback.phpt │ ├── ftp.phpt │ ├── guzzle.phpt │ ├── guzzle │ │ ├── cancel.phpt │ │ ├── cannot_cancel_finished.phpt │ │ ├── cookie.phpt │ │ ├── promise.phpt │ │ ├── request_async.phpt │ │ ├── request_on_stats.phpt │ │ └── send_async.phpt │ ├── https.phpt │ ├── keepalive.phpt │ ├── multi │ │ ├── add_after_easy_exec.phpt │ │ ├── bug4393.phpt │ │ ├── bug48203_multi.phpt │ │ ├── bug67643.phpt │ │ ├── bug71523.phpt │ │ ├── bug76675.phpt │ │ ├── bug77535.phpt │ │ ├── bug77946.phpt │ │ ├── curl_basic_018.phpt │ │ ├── curl_copy_handle_variation4.phpt │ │ ├── curl_int_cast.phpt │ │ ├── curl_multi_close_basic.phpt │ │ ├── curl_multi_close_basic001.phpt │ │ ├── curl_multi_close_reference.phpt │ │ ├── curl_multi_errno_strerror_001.phpt │ │ ├── curl_multi_getcontent_basic3.phpt │ │ ├── curl_multi_info_read.phpt │ │ ├── curl_multi_init_basic.phpt │ │ ├── curl_multi_segfault.phpt │ │ ├── curl_multi_select_basic1.phpt │ │ ├── curl_multi_setopt_basic001.phpt │ │ ├── multiple_binding.phpt │ │ └── no_hook.phpt │ ├── multi_1.phpt │ ├── multi_2.phpt │ ├── multi_3.phpt │ ├── multi_4.phpt │ ├── multi_close.phpt │ ├── multi_dtor.phpt │ ├── non_exclusive.phpt │ ├── select_cancel.phpt │ ├── select_timeout.phpt │ ├── select_twice.phpt │ ├── setopt │ │ ├── 1.phpt │ │ ├── 3.phpt │ │ ├── 4.phpt │ │ ├── 5_skip.phpt │ │ ├── filetime_1.phpt │ │ ├── filetime_2.phpt │ │ ├── header_out.phpt │ │ ├── infile.phpt │ │ └── nobody.phpt │ ├── share │ │ ├── 1.phpt │ │ └── 5.phpt │ ├── sleep.phpt │ ├── ssl │ │ └── version.phpt │ ├── symfony-noco.phpt │ ├── symfony.phpt │ ├── template │ ├── timer_coredump.phpt │ ├── undefined_behavior │ │ ├── 0.phpt │ │ ├── 1.phpt │ │ ├── 2.phpt │ │ ├── 3.phpt │ │ ├── 4.phpt │ │ ├── 5.phpt │ │ ├── 6.phpt │ │ ├── 7.phpt │ │ └── 8.phpt │ ├── upload │ │ ├── 1.phpt │ │ ├── 2.phpt │ │ ├── 3.phpt │ │ ├── curl_testdata1.txt │ │ └── curl_testdata2.txt │ └── yield_in_callback.phpt ├── swoole_event │ ├── add_after_server_start.phpt │ ├── cycle.phpt │ ├── defer.phpt │ ├── defer_with_sleep.phpt │ ├── defer_without_io.phpt │ ├── del.phpt │ ├── del_after_close.phpt │ ├── deprecated_event_wait.phpt │ ├── dispatch.phpt │ ├── function_alias.phpt │ ├── isset.phpt │ ├── rshutdown.phpt │ ├── set.phpt │ ├── simple.phpt │ ├── sockets.phpt │ ├── sync_client_1.phpt │ ├── sync_client_2.phpt │ ├── wait.phpt │ └── write.phpt ├── swoole_feature │ ├── cross_close │ │ ├── client.phpt │ │ ├── client_by_server.phpt │ │ ├── full_duplex.phpt │ │ ├── full_duplex_by_server.phpt │ │ ├── http.phpt │ │ ├── http_by_server.phpt │ │ ├── php_stream_full_duplex.phpt │ │ ├── php_stream_full_duplex_by_server.phpt │ │ ├── redis.phpt │ │ ├── redis_by_server.phpt │ │ ├── stream.phpt │ │ └── stream_by_server.phpt │ └── full_duplex │ │ ├── client.phpt │ │ ├── socket.phpt │ │ ├── socket_ssl.phpt │ │ └── websocket.phpt ├── swoole_function │ ├── substr_json_decode.phpt │ ├── substr_unserialize.phpt │ ├── swoole_clear_dns_cache.phpt │ ├── swoole_cpu_num.phpt │ ├── swoole_error_log.phpt │ ├── swoole_get_local_ip.phpt │ ├── swoole_get_local_mac.phpt │ ├── swoole_set_process_name.phpt │ ├── swoole_strerror.phpt │ └── swoole_version.phpt ├── swoole_global │ ├── channel_construct_check.phpt │ ├── closed_stdout.phpt │ ├── create_deny.phpt │ ├── function_alias.phpt │ ├── serialize_deny.phpt │ ├── socket_construct_check.phpt │ ├── too_many_objects.phpt │ ├── unset_deny.phpt │ ├── unset_property_01.phpt │ ├── unset_property_02.phpt │ └── unset_property_03.phpt ├── swoole_http2_client_coro │ ├── bug_5127.phpt │ ├── connect_twice.phpt │ ├── cookies.phpt │ ├── error.phpt │ ├── goaway.phpt │ ├── headers.phpt │ ├── host.phpt │ ├── http_proxy.phpt │ ├── huge_headers.phpt │ ├── issues_2374.phpt │ ├── multi.phpt │ ├── no-gzip.phpt │ ├── number.phpt │ ├── ping.phpt │ ├── pipeline.phpt │ ├── post.phpt │ ├── send-cookies.phpt │ ├── send_only_bug.phpt │ ├── set-cookies.phpt │ ├── sock_type_unix.phpt │ └── wrong_headers.phpt ├── swoole_http2_server │ ├── big_data.phpt │ ├── compression.phpt │ ├── compression_types.phpt │ ├── getMethod.phpt │ ├── goaway.phpt │ ├── http2_headers.phpt │ ├── issue_4365.phpt │ ├── max_concurrency.phpt │ ├── nghttp2_big_data.phpt │ ├── no_compression.phpt │ ├── ping.phpt │ ├── sendfile.phpt │ ├── sendfile_content_type.phpt │ ├── sendfile_set_content_type.phpt │ ├── static_handler.phpt │ ├── streaming.phpt │ ├── streaming_2.phpt │ ├── trailer.phpt │ └── worker_max_concurrency.phpt ├── swoole_http2_server_coro │ └── cookies.phpt ├── swoole_http_client_coro │ ├── 204.phpt │ ├── addData.phpt │ ├── alias.phpt │ ├── another_coroutine.phpt │ ├── auto_reconnect.phpt │ ├── bind_address.phpt │ ├── bug_2661.phpt │ ├── bug_3118.phpt │ ├── compression_with_big_data.phpt │ ├── connect_timeout.phpt │ ├── connection_close.phpt │ ├── construct_failed.phpt │ ├── cookies_set_bug.phpt │ ├── defer.phpt │ ├── defer_02.phpt │ ├── disable_keep_alive.phpt │ ├── download.phpt │ ├── download_302.phpt │ ├── download_failed.phpt │ ├── download_filename_bug.phpt │ ├── duplicate_header.phpt │ ├── error_handler.phpt │ ├── get.phpt │ ├── get_header_out_after_close.phpt │ ├── get_twice.phpt │ ├── get_twice_keepalive.phpt │ ├── get_without_content_length.phpt │ ├── h2c_upgrade.phpt │ ├── head_method.phpt │ ├── host.phpt │ ├── http_chunk.phpt │ ├── http_proxy.phpt │ ├── http_proxy_443.phpt │ ├── http_proxy_with_host_port.phpt │ ├── http_upload_big.phpt │ ├── https.phpt │ ├── https_upload_big.phpt │ ├── issue_2664.phpt │ ├── keep_alive.phpt │ ├── long_domain.phpt │ ├── lowercase_header.phpt │ ├── multi.phpt │ ├── multi_and_reuse.phpt │ ├── parser.phpt │ ├── post_array.phpt │ ├── reconnect_but_failed.phpt │ ├── recv_slow_timeout.phpt │ ├── recv_timeout.phpt │ ├── set_basic_auth.phpt │ ├── slow_server.phpt │ ├── socks5_proxy.phpt │ ├── ssl.phpt │ ├── ssl_host_name.phpt │ ├── ssl_verify_peer_1.phpt │ ├── ssl_verify_peer_2.phpt │ ├── timeout_before_connect.phpt │ ├── timeout_when_recv.phpt │ ├── unixsocket.phpt │ ├── upload.phpt │ ├── upload_huge.phpt │ ├── upload_with_null_args.phpt │ ├── websocket │ │ ├── 1.phpt │ │ ├── bug_01.phpt │ │ ├── bug_02.phpt │ │ ├── close_socket.phpt │ │ ├── server_push_first.phpt │ │ ├── ssl_1.phpt │ │ ├── ssl_2.phpt │ │ ├── timeout.phpt │ │ └── upgrade_after_get.phpt │ ├── write_func_1.phpt │ └── write_func_2.phpt ├── swoole_http_server │ ├── 0.phpt │ ├── If_Modified_Since.phpt │ ├── accept_encoding.phpt │ ├── buffer_output_size.phpt │ ├── bug_2368.phpt │ ├── bug_2444.phpt │ ├── bug_2608.phpt │ ├── bug_2751.phpt │ ├── bug_2786.phpt │ ├── bug_2947.phpt │ ├── bug_2988.phpt │ ├── bug_4261.phpt │ ├── bug_4857.phpt │ ├── bug_5107.phpt │ ├── bug_5114.phpt │ ├── bug_5146.phpt │ ├── bug_5186.phpt │ ├── bug_compression_level.phpt │ ├── bug_get_request_data_after_end.phpt │ ├── callback_new_obj_method.phpt │ ├── callback_new_static_method.phpt │ ├── callback_string.phpt │ ├── callback_with_internal_function.phpt │ ├── callback_with_private.phpt │ ├── callback_with_protected.phpt │ ├── chunk.phpt │ ├── chunk_with_end_data.phpt │ ├── chunked_pipeline_request.phpt │ ├── client_ca.phpt │ ├── co_switching.phpt │ ├── compression.phpt │ ├── compression_min_length.phpt │ ├── compression_types.phpt │ ├── cookieAlias.phpt │ ├── cookie_delete.phpt │ ├── cookie_samesite.phpt │ ├── cookie_vs_rawcookie.phpt │ ├── cookies.phpt │ ├── cookies_parse.phpt │ ├── create_request.phpt │ ├── data_parse.phpt │ ├── disable_compression.phpt │ ├── disable_coroutine.phpt │ ├── dispatch_mode_7.phpt │ ├── duplicate_header.phpt │ ├── enable_coroutine.phpt │ ├── error_1203.phpt │ ├── error_413.phpt │ ├── event_stream.phpt │ ├── form_data_1.phpt │ ├── form_data_with_charset.phpt │ ├── head_method.phpt │ ├── headers_sent.phpt │ ├── headers_sent_coroutine.phpt │ ├── http_autoindex.phpt │ ├── http_index_files.phpt │ ├── http_index_files_autoindex.phpt │ ├── https.phpt │ ├── issue_2360.phpt │ ├── json_encode.phpt │ ├── json_encode2.phpt │ ├── large_url.phpt │ ├── max-age.phpt │ ├── max_concurrency.phpt │ ├── max_coro_num.phpt │ ├── max_input_vars.phpt │ ├── mixed_server.phpt │ ├── new_cookie.phpt │ ├── no_compression.phpt │ ├── numeric_header_name.phpt │ ├── objectCookie.phpt │ ├── objectCookieMemory.phpt │ ├── octane_bug_651.phpt │ ├── pipeline.phpt │ ├── post.phpt │ ├── purge_method.phpt │ ├── range.phpt │ ├── range2.phpt │ ├── rawContent.phpt │ ├── rawCookie.phpt │ ├── redirect.phpt │ ├── reset_concurrency_with_base.phpt │ ├── reset_concurrency_with_process.phpt │ ├── response_create.phpt │ ├── send_500_to_client.phpt │ ├── send_empty_file.phpt │ ├── send_yield.phpt │ ├── sendfile.phpt │ ├── sendfile_client_reset.phpt │ ├── sendfile_dir.phpt │ ├── sendfile_link.phpt │ ├── sendfile_no_keepalive.phpt │ ├── sendfile_with_dispatch_mode_7.phpt │ ├── sendfile_with_ssl.phpt │ ├── set_content_length.phpt │ ├── shutdown_in_event_worker.phpt │ ├── shutdown_in_task_worker.phpt │ ├── slow_client.phpt │ ├── slow_large_post.phpt │ ├── sni │ │ └── server.phpt │ ├── static_handler.phpt │ ├── static_handler │ │ ├── locations.phpt │ │ ├── mimetype_not_exists.phpt │ │ ├── read_link_2.phpt │ │ ├── read_link_file.phpt │ │ ├── relative_path.phpt │ │ ├── relative_path_2.phpt │ │ ├── relative_path_3.phpt │ │ └── urldecode.phpt │ ├── task │ │ ├── enable_coroutine.phpt │ │ ├── enable_coroutine_with_wrong_usage.phpt │ │ └── use_object.phpt │ ├── tmp-content-type.phpt │ ├── too_many_special_chars_in_cookie.phpt │ ├── trailer.phpt │ ├── unixsocket.phpt │ ├── unixsocket2.phpt │ ├── unset_response_header.phpt │ ├── upload.phpt │ ├── upload4.phpt │ ├── uploadFile.phpt │ ├── upload_02.phpt │ ├── upload_03.phpt │ ├── upload_big_file.phpt │ ├── upload_file_array_default.phpt │ ├── upload_file_array_parsed.phpt │ ├── upload_file_empty.phpt │ ├── upload_max_filesize.phpt │ ├── worker_max_concurrency.phpt │ └── zstd.phpt ├── swoole_http_server_coro │ ├── bad_request.phpt │ ├── bug_2682.phpt │ ├── bug_3025.phpt │ ├── bug_4519.phpt │ ├── bug_no_handle.phpt │ ├── check_cookie_crlf.phpt │ ├── check_http_header_crlf.phpt │ ├── chunked_pipeline_request.phpt │ ├── close_socket.phpt │ ├── compression_min_length.phpt │ ├── compression_types.phpt │ ├── create_response.phpt │ ├── create_response_2.phpt │ ├── error_404.phpt │ ├── error_413.phpt │ ├── form_data_1.phpt │ ├── form_data_2.phpt │ ├── graceful_shutdown.phpt │ ├── handle.phpt │ ├── http2.phpt │ ├── https.phpt │ ├── ipv6.phpt │ ├── keepalive.phpt │ ├── pipeline.phpt │ ├── post_array.phpt │ ├── random_port.phpt │ ├── rawContent_get_big_data.phpt │ ├── remote_addr.phpt │ ├── restart.phpt │ ├── reuse_port.phpt │ ├── sendfile.phpt │ ├── slow_client.phpt │ ├── slow_large_post.phpt │ ├── ssl_bad_client.phpt │ ├── tcp_nodelay.phpt │ ├── upload.phpt │ ├── websocket.phpt │ ├── websocket_close.phpt │ ├── websocket_compression.phpt │ ├── websocket_mixed.phpt │ └── websocket_ping_pong.phpt ├── swoole_iouring │ ├── mix.phpt │ └── setting.phpt ├── swoole_library │ ├── array_object │ │ └── base.phpt │ ├── database │ │ ├── mysqli.phpt │ │ ├── pdo.phpt │ │ └── redis.phpt │ ├── exec │ │ ├── exec │ │ │ ├── 1.phpt │ │ │ └── 2.phpt │ │ └── shell_exec │ │ │ └── 1.phpt │ ├── multibyte_string_object │ │ └── base.phpt │ ├── name_resolver │ │ ├── 1.phpt │ │ └── lookup.phpt │ ├── string_object │ │ └── base.phpt │ └── wait_group │ │ ├── normal.phpt │ │ └── timeout.phpt ├── swoole_lock │ ├── lockwait_twice.phpt │ ├── mutex.phpt │ └── mutex_robust.phpt ├── swoole_pdo_odbc │ ├── base.phpt │ ├── blocking.phpt │ ├── query.phpt │ ├── race.phpt │ ├── server_info.phpt │ ├── sleep.phpt │ └── transaction.phpt ├── swoole_pdo_oracle │ ├── bug41996.phpt │ ├── bug44301.phpt │ ├── bug46274.phpt │ ├── bug46274_2.phpt │ ├── bug54379.phpt │ ├── bug57702.phpt │ ├── bug60994.phpt │ ├── bug_33707.phpt │ ├── checkliveness.phpt │ ├── coroutint.phpt │ ├── oci_success_with_info.phpt │ ├── pdo_oci_attr_action.phpt │ ├── pdo_oci_attr_autocommit_1.phpt │ ├── pdo_oci_attr_autocommit_2.phpt │ ├── pdo_oci_attr_autocommit_3.phpt │ ├── pdo_oci_attr_call_timeout.phpt │ ├── pdo_oci_attr_case.phpt │ ├── pdo_oci_attr_client.phpt │ ├── pdo_oci_attr_client_identifier.phpt │ ├── pdo_oci_attr_client_info.phpt │ ├── pdo_oci_attr_drivername.phpt │ ├── pdo_oci_attr_module.phpt │ ├── pdo_oci_attr_nulls_1.phpt │ ├── pdo_oci_attr_prefetch_1.phpt │ ├── pdo_oci_attr_prefetch_2.phpt │ ├── pdo_oci_attr_server.phpt │ ├── pdo_oci_class_constants.phpt │ ├── pdo_oci_debugdumpparams.phpt │ ├── pdo_oci_fread_1.phpt │ ├── pdo_oci_phpinfo.phpt │ ├── pdo_oci_quote1.phpt │ ├── pdo_oci_stmt_getcolumnmeta.phpt │ ├── pdo_oci_stream_1.phpt │ ├── pdo_oci_stream_2.phpt │ ├── pdo_oci_templob_1.phpt │ ├── pdo_oracle.inc │ ├── pecl_bug_11345.phpt │ ├── pecl_bug_6364.phpt │ ├── transcation.phpt │ └── transcation2.phpt ├── swoole_pdo_pgsql │ ├── base.phpt │ ├── blocking.phpt │ ├── bug_5635.phpt │ ├── pdo_pgsql.inc │ ├── query.phpt │ ├── race.phpt │ ├── sleep.phpt │ └── transaction.phpt ├── swoole_pdo_sqlite │ ├── bug33841.phpt │ ├── bug35336.phpt │ ├── bug38334.phpt │ ├── bug43831.phpt │ ├── bug44327_2_1.phpt │ ├── bug44327_2_2.phpt │ ├── bug44327_3_1.phpt │ ├── bug44327_3_2.phpt │ ├── bug46139.phpt │ ├── bug46542.phpt │ ├── bug48773.phpt │ ├── bug50728.phpt │ ├── bug52487.phpt │ ├── bug60104.phpt │ ├── bug66033.phpt │ ├── bug70221.phpt │ ├── bug70862.phpt │ ├── bug70862_1.phpt │ ├── bug78192_1.phpt │ ├── bug78192_2.phpt │ ├── bug79664_1.phpt │ ├── bug79664_2.phpt │ ├── bug81740.phpt │ ├── bug_42589.phpt │ ├── bug_44159_sqlite_version_1.phpt │ ├── bug_44159_sqlite_version_2.phpt │ ├── bug_47769.phpt │ ├── bug_63916-2.phpt │ ├── bug_63916_1.phpt │ ├── bug_63916_2.phpt │ ├── bug_64705.phpt │ ├── coroutine.phpt │ ├── coroutine2.phpt │ ├── debugdumpparams_001.phpt │ ├── gc.phpt │ ├── gh9032.phpt │ ├── open_basedir.phpt │ ├── pdo_035.phpt │ ├── pdo_fetch_func_001.phpt │ ├── pdo_fetch_func_001_1.phpt │ ├── pdo_sqlite.inc │ ├── pdo_sqlite_createaggregate.phpt │ ├── pdo_sqlite_createaggregate_002.phpt │ ├── pdo_sqlite_createcollation.phpt │ ├── pdo_sqlite_createfunction.phpt │ ├── pdo_sqlite_createfunction_002.phpt │ ├── pdo_sqlite_createfunction_with_flags.phpt │ ├── pdo_sqlite_extendederror_attr.phpt │ ├── pdo_sqlite_filename_uri.phpt │ ├── pdo_sqlite_get_attribute.phpt │ ├── pdo_sqlite_lastinsertid.phpt │ ├── pdo_sqlite_open_flags.phpt │ ├── pdo_sqlite_statement_getattribute.phpt │ ├── pdo_sqlite_tostring_exception.phpt │ └── pdo_sqlite_transaction.phpt ├── swoole_process │ ├── alarm.phpt │ ├── close.phpt │ ├── coro │ │ ├── ipc.phpt │ │ ├── set_protocol.phpt │ │ ├── signal.phpt │ │ └── start.phpt │ ├── ctor.phpt │ ├── daemon.phpt │ ├── deamon.phpt │ ├── echo.py │ ├── enable_coroutine.phpt │ ├── exception.phpt │ ├── exec.phpt │ ├── exit.phpt │ ├── freeQueue.phpt │ ├── getaffinity.phpt │ ├── ignore_sigpipe.phpt │ ├── ignore_sigpipe_2.phpt │ ├── kill.phpt │ ├── msgq_capacity.phpt │ ├── name.phpt │ ├── null_callback.phpt │ ├── pop.phpt │ ├── priority.phpt │ ├── priority_error.phpt │ ├── process_exec.phpt │ ├── process_msgqueue.phpt │ ├── process_push.phpt │ ├── process_select.phpt │ ├── push.phpt │ ├── read.phpt │ ├── redirect.phpt │ ├── setaffinity.phpt │ ├── signal.phpt │ ├── signal_in_manager.phpt │ ├── signal_in_manager_2.phpt │ ├── signal_in_manager_3.phpt │ ├── signal_in_task_worker.phpt │ ├── signal_twice.phpt │ ├── start.phpt │ ├── timeout.phpt │ ├── useQueue.phpt │ ├── wait.phpt │ ├── wait_signal.phpt │ ├── write.phpt │ └── write_in_worker.phpt ├── swoole_process_pool │ ├── bug_2652.phpt │ ├── create_websocket_server.phpt │ ├── detach.phpt │ ├── enable_coroutine.phpt │ ├── enable_coroutine2.phpt │ ├── export_socket.phpt │ ├── getprocess_1.phpt │ ├── getprocess_2.phpt │ ├── getprocess_3.phpt │ ├── getprocess_4.phpt │ ├── getprocess_5.phpt │ ├── master_callback.phpt │ ├── master_pid.phpt │ ├── max_wait_time.phpt │ ├── message.phpt │ ├── message_async.phpt │ ├── message_bus.phpt │ ├── message_bus_sync.phpt │ ├── msgqueue.phpt │ ├── msgqueue_2.phpt │ ├── reload.phpt │ ├── reuse_port.phpt │ ├── shutdown.phpt │ ├── socket_coro.phpt │ ├── start_pool_twice_in_same_process.phpt │ ├── start_twice.phpt │ └── worker_exit_1.phpt ├── swoole_redis_server │ ├── big_packet.phpt │ ├── empty.phpt │ ├── format.phpt │ ├── getHandler.phpt │ └── nested_map.phpt ├── swoole_runtime │ ├── accept.phpt │ ├── accept_timeout.phpt │ ├── base.phpt │ ├── bindto.phpt │ ├── bindto2.phpt │ ├── block.phpt │ ├── bug_4657.phpt │ ├── bug_5104.phpt │ ├── destruct.phpt │ ├── enable_crypto.phpt │ ├── file_hook │ │ ├── a.inc │ │ ├── b.inc │ │ ├── bug_4327.phpt │ │ ├── bug_ftell_2g.phpt │ │ ├── bug_scandir.phpt │ │ ├── fgets.phpt │ │ ├── flock.phpt │ │ ├── fread.phpt │ │ ├── include.phpt │ │ ├── include_2.phpt │ │ ├── lock_ex.phpt │ │ ├── lock_nb_1.phpt │ │ ├── lock_nb_2.phpt │ │ ├── lock_sh.phpt │ │ ├── open_basedir.phpt │ │ └── read.phpt │ ├── file_lock │ │ ├── file_lock_1.phpt │ │ ├── lock_nb.phpt │ │ └── lock_sh_1.phpt │ ├── get_hook_flags.phpt │ ├── gethostbyname.phpt │ ├── hook_default.phpt │ ├── hook_enable_coroutine.phpt │ ├── hook_set_flags.phpt │ ├── library.phpt │ ├── nonblock.phpt │ ├── out_of_coroutine.phpt │ ├── pdo.phpt │ ├── persistent.phpt │ ├── proc │ │ ├── 1.phpt │ │ ├── 2.phpt │ │ ├── 3.phpt │ │ ├── 4.phpt │ │ ├── 5.phpt │ │ ├── close_after_wait.phpt │ │ └── proc_open_pipes.inc │ ├── redis_connect.phpt │ ├── redis_pconnect.phpt │ ├── sento.phpt │ ├── set_hook_flags.phpt │ ├── sleep.phpt │ ├── sleep_yield.phpt │ ├── sockets │ │ ├── basic │ │ │ ├── bug46360.phpt │ │ │ ├── bug49341.phpt │ │ │ ├── bug63000.phpt │ │ │ ├── bug76839.phpt │ │ │ ├── ipv4loop.phpt │ │ │ ├── ipv6_skipif.inc │ │ │ ├── ipv6loop.phpt │ │ │ ├── mcast_helpers.php.inc │ │ │ ├── mcast_ipv4_recv.phpt │ │ │ ├── mcast_ipv4_send.phpt │ │ │ ├── mcast_ipv4_send_error.phpt │ │ │ ├── mcast_ipv6_recv.phpt │ │ │ ├── mcast_ipv6_recv_limited.phpt │ │ │ ├── mcast_ipv6_send.phpt │ │ │ ├── socket_accept_failure.phpt │ │ │ ├── socket_bind.phpt │ │ │ ├── socket_clear_error.phpt │ │ │ ├── socket_connect_params.phpt │ │ │ ├── socket_create_listen-nobind.phpt │ │ │ ├── socket_create_listen.phpt │ │ │ ├── socket_create_listen_used.phpt │ │ │ ├── socket_create_pair.phpt │ │ │ ├── socket_getopt.phpt │ │ │ ├── socket_getpeername.phpt │ │ │ ├── socket_getpeername_ipv4loop.phpt │ │ │ ├── socket_getpeername_ipv6loop.phpt │ │ │ ├── socket_getsockname.phpt │ │ │ ├── socket_listen-wrongparams.phpt │ │ │ ├── socket_read_params.phpt │ │ │ ├── socket_select-wrongparams-2.phpt │ │ │ ├── socket_select.phpt │ │ │ ├── socket_select_error.phpt │ │ │ ├── socket_sentto_recvfrom_ipv4_udp.phpt │ │ │ ├── socket_sentto_recvfrom_ipv6_udp.phpt │ │ │ ├── socket_sentto_recvfrom_unix.phpt │ │ │ ├── socket_set_block-retval.phpt │ │ │ ├── socket_set_nonblock-retval.phpt │ │ │ ├── socket_set_nonblock.phpt │ │ │ ├── socket_set_option_bindtodevice.phpt │ │ │ ├── socket_set_option_error_socket_option.phpt │ │ │ ├── socket_set_option_in6_pktinfo.phpt │ │ │ ├── socket_set_option_rcvtimeo.phpt │ │ │ ├── socket_set_option_seolinger.phpt │ │ │ ├── socket_set_option_sndtimeo.phpt │ │ │ ├── socket_setopt_basic.phpt │ │ │ ├── socket_shutdown.phpt │ │ │ ├── socket_strerror.phpt │ │ │ └── unixloop.phpt │ │ ├── error.phpt │ │ ├── get_name.phpt │ │ ├── import.phpt │ │ ├── nonblock.phpt │ │ ├── socketpair.phpt │ │ ├── tcp_client.phpt │ │ ├── tcp_server.phpt │ │ ├── timeout.phpt │ │ └── udp.phpt │ ├── ssl │ │ ├── capture_peer_cert.phpt │ │ ├── client.phpt │ │ ├── enable_crypto.phpt │ │ ├── local_cert.phpt │ │ ├── server.phpt │ │ └── without_key.phpt │ ├── stdin.phpt │ ├── stream_context.phpt │ ├── stream_context_pass_null.phpt │ ├── stream_copy_to_stream_socket.phpt │ ├── stream_get_meta_data.phpt │ ├── stream_select │ │ ├── base.phpt │ │ ├── blocked.phpt │ │ ├── bug46024.phpt │ │ ├── bug60120.phpt │ │ ├── bug60602.phpt │ │ ├── bug64438.phpt │ │ ├── bug64770.phpt │ │ ├── bug69521.phpt │ │ ├── bug72075.phpt │ │ ├── never_timeout.phpt │ │ ├── preserve_keys.phpt │ │ ├── return_val.phpt │ │ ├── rw_events.phpt │ │ ├── stream_set_blocking.phpt │ │ └── timeout.phpt │ ├── stream_socket_pair.phpt │ ├── tcp-c10k.phpt │ ├── tcp.phpt │ ├── udg.phpt │ ├── udp-c10k.phpt │ ├── udp.phpt │ ├── unix.phpt │ └── unsafe │ │ └── pcntl_fork.phpt ├── swoole_server │ ├── accept_zero.phpt │ ├── addListener.phpt │ ├── addProcess.phpt │ ├── addProcess_base.phpt │ ├── addProcess_with_error.phpt │ ├── addProcess_with_event_wait.phpt │ ├── addProcess_with_tick.phpt │ ├── base │ │ ├── reload_1.phpt │ │ ├── reload_2.phpt │ │ ├── shutdown.phpt │ │ └── shutdown_single.phpt │ ├── bigPipeMessage.phpt │ ├── big_session_id.phpt │ ├── big_udp_packet.phpt │ ├── bind.phpt │ ├── bug_11000_01.phpt │ ├── bug_1864.phpt │ ├── bug_2308.phpt │ ├── bug_2313.phpt │ ├── bug_2639.phpt │ ├── bug_2736.phpt │ ├── bug_aio.phpt │ ├── check_callback.phpt │ ├── check_chunk_total_size.phpt │ ├── client_close_in_writable_event.phpt │ ├── close_force.phpt │ ├── close_in_connect_callback.phpt │ ├── close_in_manager.phpt │ ├── close_in_master.phpt │ ├── close_in_non_current_worker.phpt │ ├── close_in_other_worker_with_base.phpt │ ├── close_in_task_worker.phpt │ ├── close_max_fd.phpt │ ├── close_queued.phpt │ ├── close_reset.phpt │ ├── command.phpt │ ├── connections.phpt │ ├── discard_timeout_packet.phpt │ ├── dispatch_fallback.phpt │ ├── dispatch_func.phpt │ ├── dispatch_func_discard.phpt │ ├── dispatch_func_memory_leak.phpt │ ├── dispatch_mode_1.phpt │ ├── dispatch_mode_10.phpt │ ├── dispatch_mode_3.phpt │ ├── dispatch_mode_7.phpt │ ├── dispatch_mode_8.phpt │ ├── dispatch_mode_9.phpt │ ├── duplicate_registered.phpt │ ├── enable_coroutine.phpt │ ├── enable_delay_receive.phpt │ ├── enable_reuse_port.phpt │ ├── eof_protocol.phpt │ ├── eof_server.phpt │ ├── event │ │ ├── before_shutdown.phpt │ │ ├── manager_start.phpt │ │ ├── manager_stop.phpt │ │ ├── shutdown.phpt │ │ ├── start.phpt │ │ └── worker_exit.phpt │ ├── exist.phpt │ ├── force_reload.phpt │ ├── force_reload2.phpt │ ├── force_reload3.phpt │ ├── force_reload4.phpt │ ├── getCallback.phpt │ ├── getClientInfo.phpt │ ├── getClientInfo_in_callback_of_close.phpt │ ├── getClientInfo_in_callback_of_close_2.phpt │ ├── getClientList.phpt │ ├── getLastError.phpt │ ├── getSocket.phpt │ ├── getWorkerStatus.phpt │ ├── heartbeat.phpt │ ├── heartbeat_true.phpt │ ├── heartbeat_with_base.phpt │ ├── http_protocol.phpt │ ├── idle_worekr_num.phpt │ ├── invalid_fd.phpt │ ├── invalid_option.phpt │ ├── kill_user_process_01.phpt │ ├── kill_user_process_02.phpt │ ├── kill_worker_01.phpt │ ├── kill_worker_02.phpt │ ├── last_time.phpt │ ├── length │ │ ├── 00.phpt │ │ ├── 01.phpt │ │ ├── 02.phpt │ │ ├── 03.phpt │ │ └── length_func.phpt │ ├── listen_fail.phpt │ ├── max_idle_time_1.phpt │ ├── max_idle_time_2.phpt │ ├── max_queued_bytes.phpt │ ├── max_request.phpt │ ├── max_request_grace_disabled.phpt │ ├── max_request_grace_enabled.phpt │ ├── max_request_threshold.phpt │ ├── memory_leak │ │ ├── length.phpt │ │ ├── pipe_message.phpt │ │ ├── task.phpt │ │ └── tcp.phpt │ ├── mqtt │ │ ├── length_offset.phpt │ │ ├── recv_fail.phpt │ │ └── send_big_pack.phpt │ ├── new_twice.phpt │ ├── object │ │ ├── event.phpt │ │ ├── getManagerPid.phpt │ │ ├── getMasterPid.phpt │ │ ├── getWorkerId.phpt │ │ ├── getWorkerPid.phpt │ │ ├── packet.phpt │ │ ├── pipe_message.phpt │ │ ├── status_info.phpt │ │ └── task_result.phpt │ ├── onReload.phpt │ ├── parse_option_to_size.phpt │ ├── pid_file.phpt │ ├── protect.phpt │ ├── protect_false.phpt │ ├── reload.phpt │ ├── reload_async.phpt │ ├── reload_process.phpt │ ├── sendMessage_1.phpt │ ├── sendMessage_2.phpt │ ├── sendMessage_3.phpt │ ├── sendMessage_4.phpt │ ├── sendMessage_in_manager.phpt │ ├── send_2.phpt │ ├── send_2m_in_task_worker.phpt │ ├── send_2m_in_user_process.phpt │ ├── send_3.phpt │ ├── send_big_packet.phpt │ ├── send_in_master.phpt │ ├── send_in_other_worker_with_base.phpt │ ├── sendfile.phpt │ ├── sendfile_02.phpt │ ├── sendfile_ssl.phpt │ ├── sendto_timeout.phpt │ ├── shutdown.phpt │ ├── shutdown_in_master.phpt │ ├── shutdown_in_process.phpt │ ├── shutdown_with_base_mode.phpt │ ├── sigint_with_base.phpt │ ├── sigint_with_process.phpt │ ├── single_thread │ │ ├── heartbeat.phpt │ │ ├── large_packet.phpt │ │ └── user_setting.phpt │ ├── sleep.phpt │ ├── slow_client.phpt │ ├── slow_master.phpt │ ├── slow_worker.phpt │ ├── ssl │ │ ├── 00.phpt │ │ ├── bad_client.phpt │ │ ├── code │ │ │ ├── client.go │ │ │ └── client.js │ │ ├── dtls.phpt │ │ ├── dtls_big_packet.phpt │ │ ├── dtls_with_length_protocol.phpt │ │ ├── golang.phpt │ │ ├── heartbeat_1.phpt │ │ ├── heartbeat_2.phpt │ │ ├── nodejs.phpt │ │ ├── ssl_send_wait.phpt │ │ ├── verify_01.phpt │ │ ├── verify_02.phpt │ │ └── verify_03.phpt │ ├── start_twice.phpt │ ├── stats.phpt │ ├── stats_file.phpt │ ├── stats_file_json.phpt │ ├── stats_file_php.phpt │ ├── stop.phpt │ ├── stop_in_workerStart.phpt │ ├── systemd_fds.phpt │ ├── task │ │ ├── base.phpt │ │ ├── bug_2585.phpt │ │ ├── callback_is_null.phpt │ │ ├── enable_coroutine.phpt │ │ ├── finish_timeout.phpt │ │ ├── huge_data.phpt │ │ ├── idle_worekr_num.phpt │ │ ├── invalid_packet.phpt │ │ ├── kill_01.phpt │ │ ├── kill_02.phpt │ │ ├── kill_task_worker_02.phpt │ │ ├── scheduler_warning.phpt │ │ ├── task_callback.phpt │ │ ├── task_co.phpt │ │ ├── task_enable_coroutine.phpt │ │ ├── task_enable_coroutine_return.phpt │ │ ├── task_in_manager.phpt │ │ ├── task_in_master.phpt │ │ ├── task_in_task_worker.phpt │ │ ├── task_in_user_process.phpt │ │ ├── task_ipc_mode_2.phpt │ │ ├── task_ipc_mode_3.phpt │ │ ├── task_max_request.phpt │ │ ├── task_pack.phpt │ │ ├── task_queue.phpt │ │ ├── task_wait.phpt │ │ ├── timer.phpt │ │ ├── unpack.phpt │ │ └── without_onfinish.phpt │ ├── taskWaitMulti.phpt │ ├── taskwait_01.phpt │ ├── taskwait_02.phpt │ ├── unregistered_signal.phpt │ ├── unsock_dgram.phpt │ ├── unsock_stream.phpt │ ├── user_process.phpt │ ├── user_process_2.phpt │ ├── user_process_force_exit.phpt │ ├── user_process_pid.phpt │ ├── wrong_eof_setting.phpt │ └── z_conn_10k.phpt ├── swoole_server_coro │ ├── length_1.phpt │ ├── random_port.phpt │ ├── reuse_port.phpt │ ├── ssl.phpt │ └── tcp.phpt ├── swoole_server_port │ ├── connections.phpt │ ├── duplicate_registered.phpt │ ├── heartbeat_1.phpt │ ├── heartbeat_2.phpt │ ├── heartbeat_3.phpt │ ├── http.phpt │ ├── multi_port.phpt │ ├── sub_handshake.phpt │ └── tcp_eof.phpt ├── swoole_socket_coro │ ├── accept.phpt │ ├── all.phpt │ ├── cancel.phpt │ ├── check_writev_readv_param_type.phpt │ ├── closed.phpt │ ├── complete_test.phpt │ ├── concurrency.phpt │ ├── construct_parse_args_failed.phpt │ ├── fd.phpt │ ├── getBoundCid.phpt │ ├── getopt │ │ ├── get.phpt │ │ └── tcpinfo.phpt │ ├── getpeername.phpt │ ├── getsockname.phpt │ ├── icmp.phpt │ ├── import_1.phpt │ ├── import_2.phpt │ ├── import_3.phpt │ ├── import_4.phpt │ ├── import_5.phpt │ ├── iov_max.phpt │ ├── peek_and_checkLiveness.phpt │ ├── protocol │ │ ├── bug_3586.phpt │ │ └── package_length_func.phpt │ ├── readVectorAll.phpt │ ├── readVectorAll_ssl.phpt │ ├── readVector_ssl.phpt │ ├── readVector_ssl_eagain.phpt │ ├── readv.phpt │ ├── readv_eagain.phpt │ ├── recvAll.phpt │ ├── recvAll_timeout.phpt │ ├── recv_bad_packet.phpt │ ├── recv_line.phpt │ ├── recv_timeout.phpt │ ├── recv_with_buffer.phpt │ ├── reuse.phpt │ ├── reuse_2.phpt │ ├── sendfile.phpt │ ├── sendto.phpt │ ├── sendto_big.phpt │ ├── sendto_large_packet.phpt │ ├── server_accept.phpt │ ├── setopt │ │ ├── bindtodevice.phpt │ │ ├── ipv6_pktinfo.phpt │ │ ├── multicast.phpt │ │ ├── recvtimeo.phpt │ │ └── reuse.phpt │ ├── shutdown.phpt │ ├── ssl.phpt │ ├── ssl_bad_server.phpt │ ├── tcp-c10k.phpt │ ├── ulimit.phpt │ ├── unix_dgram.phpt │ ├── unix_stream.phpt │ ├── writeVectorAll.phpt │ ├── writeVectorAll_ssl.phpt │ ├── writeVector_ssl.phpt │ ├── writeVector_ssl_eagain.phpt │ ├── writev.phpt │ └── writev_eagain.phpt ├── swoole_table │ ├── big_size.phpt │ ├── bug_2263.phpt │ ├── bug_2290.phpt │ ├── create_10k_object.phpt │ ├── del.phpt │ ├── force_unlock.phpt │ ├── foreach.phpt │ ├── getMemorySize_1.phpt │ ├── get_after_destroy.phpt │ ├── get_before_create.phpt │ ├── gh-5789.phpt │ ├── incr_after_del.phpt │ ├── int.phpt │ ├── key_value.phpt │ ├── negative.phpt │ ├── random_bytes.phpt │ ├── set_after_del.phpt │ ├── stats.phpt │ └── type_conv.phpt ├── swoole_thread │ ├── add_update.phpt │ ├── affinity.phpt │ ├── arraylist.phpt │ ├── async-io.phpt │ ├── atomic_ctor.phpt │ ├── barrier.phpt │ ├── co-stream.phpt │ ├── empty_args.phpt │ ├── exit.phpt │ ├── fatal_error_1.inc │ ├── fatal_error_1.phpt │ ├── fatal_error_2.inc │ ├── fatal_error_2.phpt │ ├── fatal_error_3.phpt │ ├── incr.phpt │ ├── info.phpt │ ├── lock.phpt │ ├── map.phpt │ ├── map2array.phpt │ ├── name.phpt │ ├── numeric_strkey.phpt │ ├── php_socket.phpt │ ├── pipe.phpt │ ├── priority.phpt │ ├── putenv.phpt │ ├── queue.phpt │ ├── queue_notify_all.phpt │ ├── server │ │ ├── base.phpt │ │ ├── bug_5662.phpt │ │ ├── bug_5694.phpt │ │ ├── create_response.phpt │ │ ├── exit.phpt │ │ ├── fatal_error.phpt │ │ ├── functions.inc │ │ ├── heartbeat.phpt │ │ ├── hook_flags.phpt │ │ ├── listen.phpt │ │ ├── manager_timer.phpt │ │ ├── reload.phpt │ │ ├── reload_task_workers.phpt │ │ ├── reload_task_workers_async.phpt │ │ ├── reset_concurrency.phpt │ │ ├── send_in_user_process.phpt │ │ ├── send_large_packet.phpt │ │ ├── setting.phpt │ │ ├── stop_worker.phpt │ │ ├── udp_port.phpt │ │ └── websocket.phpt │ ├── shell_exec.phpt │ ├── signal.phpt │ ├── sort.phpt │ ├── stdio.phpt │ ├── stream.phpt │ ├── stream_arg.phpt │ ├── thread_status.phpt │ └── yield.phpt ├── swoole_timer │ ├── after.phpt │ ├── after_fork.phpt │ ├── bug_2342.phpt │ ├── bug_4794.phpt │ ├── bug_4794_2.phpt │ ├── bug_4794_3.phpt │ ├── bug_4794_4.phpt │ ├── bug_4794_5.phpt │ ├── bug_4794_6.phpt │ ├── bug_4794_7.phpt │ ├── bug_4794_8.phpt │ ├── call_private.phpt │ ├── callback_bug_with_array.phpt │ ├── clearAll.phpt │ ├── enable_coroutine.phpt │ ├── enable_coroutine2.phpt │ ├── function_alias.phpt │ ├── greater_than_0.phpt │ ├── info.phpt │ ├── list.phpt │ ├── manager.phpt │ ├── master.phpt │ ├── master_base.phpt │ ├── memory.phpt │ ├── next_round.phpt │ ├── not_exist.phpt │ ├── reinit_1.phpt │ ├── reinit_2.phpt │ ├── stats.phpt │ ├── swoole_timer_list_alias.phpt │ ├── task_worker.phpt │ ├── task_worker_tick_1k.phpt │ └── verify.phpt ├── swoole_websocket_server │ ├── bug_1.phpt │ ├── close_frame_flag.phpt │ ├── close_frame_full.phpt │ ├── compression.phpt │ ├── disconnect.phpt │ ├── disconnect_with_code.phpt │ ├── dynamic_property.phpt │ ├── empty_message.phpt │ ├── exists_and_isEstablished.phpt │ ├── fin.phpt │ ├── fin2.phpt │ ├── get_large_requests.phpt │ ├── get_small_requests.phpt │ ├── greeter.phpt │ ├── header_token.phpt │ ├── listener.phpt │ ├── malformed_data.phpt │ ├── memory.phpt │ ├── message_size.phpt │ ├── onDisconnct.phpt │ ├── pack.phpt │ ├── pingloop.phpt │ ├── pingloop_open_ping_pong_frame.phpt │ ├── pingpong.phpt │ ├── pingpong_open_ping_pong_frame.phpt │ ├── query.phpt │ ├── recv_decode.phpt │ ├── send_encode.phpt │ ├── send_encode_async.phpt │ ├── set_cookie_on_before_handshake_response.phpt │ ├── set_cookie_on_handshake.phpt │ └── websocket_compress_on_handshake.phpt ├── template └── test.sql ├── thirdparty ├── boost │ └── asm │ │ ├── LICENSE │ │ ├── combined.S │ │ ├── jump_arm64_aapcs_elf_gas.S │ │ ├── jump_arm64_aapcs_macho_gas.S │ │ ├── jump_combined_sysv_macho_gas.S │ │ ├── jump_loongarch64_sysv_elf_gas.S │ │ ├── jump_mips64_n64_elf_gas.S │ │ ├── jump_ppc64_sysv_elf_gas.S │ │ ├── jump_ppc64_sysv_macho_gas.S │ │ ├── jump_ppc64_sysv_xcoff_gas.S │ │ ├── jump_riscv64_sysv_elf_gas.S │ │ ├── jump_sparc64_sysv_elf_gas.S │ │ ├── jump_x86_64_sysv_elf_gas.S │ │ ├── jump_x86_64_sysv_macho_gas.S │ │ ├── make_arm64_aapcs_elf_gas.S │ │ ├── make_arm64_aapcs_macho_gas.S │ │ ├── make_combined_sysv_macho_gas.S │ │ ├── make_loongarch64_sysv_elf_gas.S │ │ ├── make_mips64_n64_elf_gas.S │ │ ├── make_ppc64_sysv_elf_gas.S │ │ ├── make_ppc64_sysv_macho_gas.S │ │ ├── make_ppc64_sysv_xcoff_gas.S │ │ ├── make_riscv64_sysv_elf_gas.S │ │ ├── make_sparc64_sysv_elf_gas.S │ │ ├── make_x86_64_sysv_elf_gas.S │ │ └── make_x86_64_sysv_macho_gas.S ├── hiredis │ ├── CHANGELOG.md │ ├── COPYING │ ├── README.md │ ├── alloc.c │ ├── alloc.h │ ├── fmacros.h │ ├── hiredis.c │ ├── hiredis.h │ ├── net.c │ ├── net.h │ ├── read.c │ ├── read.h │ ├── sds.c │ ├── sds.h │ └── sdsalloc.h ├── multipart_parser.c ├── multipart_parser.h ├── nghttp2 │ ├── COPYING │ ├── LICENSE │ ├── nghttp2.h │ ├── nghttp2_buf.c │ ├── nghttp2_buf.h │ ├── nghttp2_hd.c │ ├── nghttp2_hd.h │ ├── nghttp2_hd_huffman.c │ ├── nghttp2_hd_huffman.h │ ├── nghttp2_hd_huffman_data.c │ ├── nghttp2_helper.c │ ├── nghttp2_mem.c │ ├── nghttp2_mem.h │ ├── nghttp2_rcbuf.c │ ├── nghttp2_rcbuf.h │ └── nghttp2ver.h ├── nlohmann │ ├── LICENSE.MIT │ ├── adl_serializer.hpp │ ├── detail │ │ ├── conversions │ │ │ ├── from_json.hpp │ │ │ ├── to_chars.hpp │ │ │ └── to_json.hpp │ │ ├── exceptions.hpp │ │ ├── input │ │ │ ├── binary_reader.hpp │ │ │ ├── input_adapters.hpp │ │ │ ├── json_sax.hpp │ │ │ ├── lexer.hpp │ │ │ ├── parser.hpp │ │ │ └── position_t.hpp │ │ ├── iterators │ │ │ ├── internal_iterator.hpp │ │ │ ├── iter_impl.hpp │ │ │ ├── iteration_proxy.hpp │ │ │ ├── iterator_traits.hpp │ │ │ ├── json_reverse_iterator.hpp │ │ │ └── primitive_iterator.hpp │ │ ├── json_pointer.hpp │ │ ├── json_ref.hpp │ │ ├── macro_scope.hpp │ │ ├── macro_unscope.hpp │ │ ├── meta │ │ │ ├── cpp_future.hpp │ │ │ ├── detected.hpp │ │ │ ├── is_sax.hpp │ │ │ ├── type_traits.hpp │ │ │ └── void_t.hpp │ │ ├── output │ │ │ ├── binary_writer.hpp │ │ │ ├── output_adapters.hpp │ │ │ └── serializer.hpp │ │ └── value_t.hpp │ ├── json.hpp │ ├── json_fwd.hpp │ └── thirdparty │ │ └── hedley │ │ ├── hedley.hpp │ │ └── hedley_undef.hpp ├── php │ ├── LICENSE │ ├── curl │ │ ├── curl_arginfo.h │ │ ├── curl_private.h │ │ ├── interface.cc │ │ ├── multi.cc │ │ └── php_curl.h │ ├── main │ │ └── SAPI.h │ ├── sockets │ │ ├── conversions.cc │ │ ├── conversions.h │ │ ├── multicast.cc │ │ ├── multicast.h │ │ ├── php_sockets_cxx.h │ │ ├── sendrecvmsg.cc │ │ └── sockaddr_conv.cc │ ├── standard │ │ ├── proc_open.cc │ │ ├── proc_open.h │ │ └── var_decoder.cc │ └── streams │ │ ├── php_streams_int.h │ │ └── plain_wrapper.c ├── php81 │ ├── pdo_oci │ │ ├── oci_driver.c │ │ ├── oci_statement.c │ │ └── php_pdo_oci_int.h │ ├── pdo_odbc │ │ ├── odbc_driver.c │ │ ├── odbc_stmt.c │ │ └── php_pdo_odbc_int.h │ ├── pdo_pgsql │ │ ├── pgsql_driver.c │ │ ├── pgsql_driver_arginfo.h │ │ ├── pgsql_statement.c │ │ └── php_pdo_pgsql_int.h │ └── pdo_sqlite │ │ ├── php_pdo_sqlite_int.h │ │ ├── sqlite_driver.c │ │ ├── sqlite_driver.stub.php │ │ ├── sqlite_driver_arginfo.h │ │ └── sqlite_statement.c ├── php83 │ ├── pdo_oci │ │ ├── oci_driver.c │ │ ├── oci_statement.c │ │ └── php_pdo_oci_int.h │ ├── pdo_odbc │ │ ├── odbc_driver.c │ │ ├── odbc_stmt.c │ │ └── php_pdo_odbc_int.h │ ├── pdo_pgsql │ │ ├── pgsql_driver.c │ │ ├── pgsql_driver_arginfo.h │ │ ├── pgsql_statement.c │ │ └── php_pdo_pgsql_int.h │ └── pdo_sqlite │ │ ├── php_pdo_sqlite_int.h │ │ ├── sqlite_driver.c │ │ ├── sqlite_driver.stub.php │ │ ├── sqlite_driver_arginfo.h │ │ └── sqlite_statement.c ├── php84 │ ├── curl │ │ ├── curl_arginfo.h │ │ ├── curl_private.h │ │ ├── interface.cc │ │ ├── multi.cc │ │ └── php_curl.h │ ├── pdo_oci │ │ ├── LICENSE │ │ ├── oci_driver.c │ │ ├── oci_statement.c │ │ └── php_pdo_oci_int.h │ ├── pdo_odbc │ │ ├── odbc_driver.c │ │ ├── odbc_stmt.c │ │ └── php_pdo_odbc_int.h │ ├── pdo_pgsql │ │ ├── pgsql_driver.c │ │ ├── pgsql_driver_arginfo.h │ │ ├── pgsql_sql_parser.c │ │ ├── pgsql_statement.c │ │ └── php_pdo_pgsql_int.h │ └── pdo_sqlite │ │ ├── php_pdo_sqlite_int.h │ │ ├── sqlite_driver.c │ │ ├── sqlite_driver.stub.php │ │ ├── sqlite_driver_arginfo.h │ │ ├── sqlite_sql_parser.c │ │ └── sqlite_statement.c ├── swoole_http_parser.c └── swoole_http_parser.h └── tools ├── analysis.php ├── arginfo-check.php ├── bootstrap.php ├── build-library.php ├── code-generator.php ├── composer.json ├── constant-generator.php ├── export.php ├── gen-data.php ├── gen-ext-class.php ├── get-ip-info.php ├── next-version.php ├── option-generator.php ├── pecl-package.php ├── phpt-fixer.php ├── rename.php ├── send-http-data.php ├── show-big-files.php └── templates ├── class.c └── version.tpl.h /.gitattributes: -------------------------------------------------------------------------------- 1 | /.github/ export-ignore 2 | /benchmark/ export-ignore 3 | /core-tests/ export-ignore 4 | *.h linguist-language=cpp 5 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "src/core/error.cc" 3 | - "thirdparty/hiredis/*" 4 | 5 | coverage: 6 | range: 60..80 7 | round: down 8 | precision: 2 9 | -------------------------------------------------------------------------------- /docs/CODE-STYLE.md: -------------------------------------------------------------------------------- 1 | Code Style 2 | ======= 3 | * Google C++ Style 4 | * Indent adjusted to 4 characters 5 | * Line width adjusted to 120 characters 6 | 7 | -------------------------------------------------------------------------------- /docs/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | set noparent 2 | filter=-build/include_alpha,-build/include_subdir,-build/include_what_you_use,-legal/copyright,-readability/nolint 3 | braces=4 4 | linelength=120 5 | -------------------------------------------------------------------------------- /examples/atomic/long.php: -------------------------------------------------------------------------------- 1 | get()."\n"; 4 | echo $l->add(20)."\n"; 5 | echo $l->sub(20)."\n"; 6 | echo $l->sub(-20)."\n"; 7 | echo $l->cmpset(-2 ** 36, 0)."\n"; 8 | echo $l->cmpset(-2 ** 36 + 20, 0)."\n"; 9 | -------------------------------------------------------------------------------- /examples/atomic/test.php: -------------------------------------------------------------------------------- 1 | add(12)."\n"; 4 | echo $atomic->sub(11)."\n"; 5 | echo $atomic->cmpset(122, 999)."\n"; 6 | echo $atomic->cmpset(124, 999)."\n"; 7 | echo $atomic->get()."\n"; 8 | -------------------------------------------------------------------------------- /examples/atomic/wait.php: -------------------------------------------------------------------------------- 1 | 0) 5 | { 6 | echo "master start\n"; 7 | $n->wait(1.5); 8 | echo "master end\n"; 9 | } 10 | else 11 | { 12 | echo "child start\n"; 13 | sleep(1); 14 | $n->wakeup(); 15 | echo "child end\n"; 16 | } 17 | -------------------------------------------------------------------------------- /examples/client/long_tcp.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9501)) 6 | { 7 | exit("connect failed\n"); 8 | } 9 | $client->send(str_repeat("A", 600)); 10 | $data = $client->recv(7000, 0); 11 | if($data === false) 12 | { 13 | echo "recv fail\n"; 14 | break; 15 | } 16 | var_dump($data); 17 | $client->close(); 18 | } 19 | -------------------------------------------------------------------------------- /examples/client/recv_1m.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9509, 60); 5 | $c->send("AAAAAAAAAAAAAAAA"); 6 | 7 | $n_bytes = 0; 8 | 9 | while (true) 10 | { 11 | $line = $c->recv(); 12 | if ($line === false) 13 | { 14 | echo "recv failed.\n"; 15 | break; 16 | } 17 | elseif (empty($line)) 18 | { 19 | echo "recv $n_bytes bytes\n"; 20 | break; 21 | } 22 | else 23 | { 24 | fwrite($f, $line); 25 | $n_bytes += strlen($line); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/client/simple.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9501, 0.5, 0); 6 | if (!$ret) { 7 | echo "Over flow. errno=" . $client->errCode; 8 | die("\n"); 9 | } 10 | $clients[] = $client; 11 | } 12 | sleep(1); 13 | while (1) { 14 | foreach ($clients as $client) { 15 | $client->send("sss"); 16 | $data = $client->recv(); 17 | var_dump($data); 18 | } 19 | sleep(1); 20 | } 21 | -------------------------------------------------------------------------------- /examples/client/test.txt: -------------------------------------------------------------------------------- 1 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx 2 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx 3 | XXXXXXXXXXXXXXXXXXXXXXx 4 | XXXXXXXXXXXXXXXXXXXXX 5 | XXXXXXXXXXXXXXXXXXXXXXX 6 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 7 | BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 8 | TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 9 | DDDDDDDDDDDDDDDDDDDDDDDDDDD 10 | -------------------------------------------------------------------------------- /examples/client/udp_sync.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9502); 4 | 5 | for ($i = 0; $i < 100; $i++) 6 | { 7 | $client->send("admin"); 8 | echo $client->recv()."\n"; 9 | sleep(1); 10 | } 11 | -------------------------------------------------------------------------------- /examples/coroutine/behavior/do-while.php: -------------------------------------------------------------------------------- 1 | 2000, 4 | 'death_loop_threshold' => 5, 5 | ]); 6 | echo "start\n"; 7 | go(function () { 8 | echo "coro start\n"; 9 | do{ 10 | echo "111\n"; 11 | sleep(1); 12 | } while(1); 13 | }); 14 | 15 | go(function () { 16 | echo "222222\n"; 17 | }); 18 | echo "end\n"; 19 | -------------------------------------------------------------------------------- /examples/coroutine/behavior/foreach.php: -------------------------------------------------------------------------------- 1 | $v){ 7 | echo $v."\n"; 8 | } 9 | }); 10 | 11 | go(function () { 12 | echo "222222\n"; 13 | }); 14 | echo "end\n"; 15 | -------------------------------------------------------------------------------- /examples/coroutine/behavior/goto.php: -------------------------------------------------------------------------------- 1 | 5000, 4 | ]); 5 | $s = microtime(1); 6 | echo "start\n"; 7 | 8 | $flag = 1; 9 | go(function () use (&$flag){ 10 | echo "coro 1 start\n"; 11 | $i = 0; 12 | while($flag) { 13 | $i ++; 14 | echo "$i\n"; 15 | sleep(1); 16 | } 17 | echo "coro 1 can exit\n"; 18 | }); 19 | 20 | $t = microtime(1); 21 | $u = $t-$s; 22 | echo "use time $u s\n"; 23 | go(function () use (&$flag){ 24 | echo " coro 2 set flag = false\n"; 25 | $flag = false; 26 | }); 27 | echo "end\n"; 28 | -------------------------------------------------------------------------------- /examples/coroutine/coro_array_map.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9501, 1); 15 | echo "co resume : connect ret = ".var_export($res,1)."\n"; 16 | echo "map func end \n"; 17 | }); 18 | } 19 | echo "main end\n"; 20 | -------------------------------------------------------------------------------- /examples/coroutine/coro_call_user.php: -------------------------------------------------------------------------------- 1 | 1]); 4 | 5 | co::create(function() { 6 | echo "co func start\n"; 7 | $name = "call_user_func"; 8 | $ret = $name("test","test\n"); 9 | echo "co func end ret:{$ret}\n"; 10 | }); 11 | 12 | function test($params) 13 | { 14 | echo "func params:$params"; 15 | co::sleep(1); 16 | echo "func end\n"; 17 | return "test return\n"; 18 | } 19 | echo "main script last\n"; 20 | -------------------------------------------------------------------------------- /examples/coroutine/coro_destruct.php: -------------------------------------------------------------------------------- 1 | test(); 28 | echo "end \n"; 29 | -------------------------------------------------------------------------------- /examples/coroutine/coro_empty.php: -------------------------------------------------------------------------------- 1 | 1]); 3 | 4 | co::create(function () { 5 | echo "no coro exit\n"; 6 | }); 7 | echo "exec file end\n"; 8 | -------------------------------------------------------------------------------- /examples/coroutine/coro_gethost.php: -------------------------------------------------------------------------------- 1 | 1]); 4 | 5 | co::create(function() { 6 | 7 | 8 | $function = new ReflectionFunction('title'); 9 | 10 | $function->invoke(); 11 | echo "invoke444\n"; 12 | 13 | }); 14 | 15 | function title() { 16 | echo "333invoke_________________________________\n"; 17 | $tcpclient = new Swoole\Coroutine\Client(SWOOLE_SOCK_TCP); 18 | var_dump($tcpclient->connect('127.0.0.1', 9501, 1)); 19 | 20 | } 21 | 22 | echo "111\n"; 23 | -------------------------------------------------------------------------------- /examples/coroutine/coro_nested.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9501, 1); 9 | echo "co[1] connect ret = ".var_export($res,1)."\n"; 10 | co::sleep(1); 11 | $res = $client->send("hello world\n"); 12 | echo "co[1] send ret = ".var_export($res,1)."\n"; 13 | $res = $client->recv(); 14 | echo "co[1] recv ret = ".var_export($res,1)."\n"; 15 | echo "co[1] exit\n"; 16 | }); 17 | echo "out coro \n"; 18 | -------------------------------------------------------------------------------- /examples/coroutine/coro_nested_empty.php: -------------------------------------------------------------------------------- 1 | 1024*1024*4]); 5 | 6 | co::create(function () { 7 | var_dump(co::stats()); 8 | echo "no coro exit\n"; 9 | }); 10 | echo "exec file end\n"; 11 | -------------------------------------------------------------------------------- /examples/coroutine/coro_sleep.php: -------------------------------------------------------------------------------- 1 | lock(); 8 | Co::sleep(1); 9 | $lock->unlock(); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /examples/coroutine/defer.php: -------------------------------------------------------------------------------- 1 | getMessage(), "\n"; 10 | } finally { 11 | echo "First finally.\n"; 12 | } 13 | }); 14 | echo "exec file end\n"; 15 | -------------------------------------------------------------------------------- /examples/coroutine/exec.php: -------------------------------------------------------------------------------- 1 | getStatus() === 1); 23 | assert($e->getFlags() === SWOOLE_EXIT_IN_COROUTINE); 24 | return; 25 | } 26 | }); 27 | -------------------------------------------------------------------------------- /examples/coroutine/exit_with_status.php: -------------------------------------------------------------------------------- 1 | getStatus(); 9 | } 10 | }); 11 | Swoole\Event::wait(); 12 | exit($exit_status); 13 | -------------------------------------------------------------------------------- /examples/coroutine/fgets.php: -------------------------------------------------------------------------------- 1 | SWOOLE_TRACE_HTTP2, 4 | 'log_level' => 0, 5 | ]); 6 | Co\run(function () { 7 | $client = new Swoole\Coroutine\Http\Client('www.jd.com', 443, true); 8 | $client->set(['write_func' => function($client, $data) { 9 | var_dump(strlen($data)); 10 | }]); 11 | $client->get('/'); 12 | var_dump(strlen($client->getBody())); 13 | return 0; 14 | }); 15 | -------------------------------------------------------------------------------- /examples/coroutine/http_client.php: -------------------------------------------------------------------------------- 1 | setHeaders(['Host' => 'localhost']); 6 | $cli->set(['http_proxy_host' => HTTP_PROXY_HOST, 'http_proxy_port' => HTTP_PROXY_PORT]); 7 | $result = $cli->get('/get?json=true'); 8 | var_dump($cli->body); 9 | // assert($result); 10 | // $ret = json_decode($cli->body, true); 11 | // assert(is_array($ret) and $ret['json'] == 'true'); 12 | }); 13 | -------------------------------------------------------------------------------- /examples/coroutine/http_download.php: -------------------------------------------------------------------------------- 1 | set(['timeout' => -1]); 9 | $cli->setHeaders([ 10 | 'Host' => $host, 11 | "User-Agent" => 'Chrome/49.0.2587.3', 12 | 'Accept' => '*', 13 | 'Accept-Encoding' => 'gzip' 14 | ]); 15 | $cli->download('/dist/skin1/images/logo-white.png', '/tmp/logo.png'); 16 | }); 17 | -------------------------------------------------------------------------------- /examples/coroutine/list_coroutines.php: -------------------------------------------------------------------------------- 1 | connect([ 7 | 'host' => '127.0.0.1', 8 | 'port' => 3306, 9 | 'user' => 'root', 10 | 'password' => 'root', 11 | 'database' => 'test', 12 | ]); 13 | $res = $swoole_mysql->escape(""); 14 | var_dump($res); 15 | }); 16 | 17 | -------------------------------------------------------------------------------- /examples/coroutine/mysql_execute_empty.php: -------------------------------------------------------------------------------- 1 | '127.0.0.1', 6 | 'user' => 'root', 7 | 'password' => 'root', 8 | 'database' => 'test' 9 | ]; 10 | $db->connect($server); 11 | $stmt = $db->prepare('SELECT * FROM `userinfo`'); 12 | $ret = $stmt->execute(); 13 | var_dump($ret); 14 | }); 15 | -------------------------------------------------------------------------------- /examples/coroutine/mysql_prepare_2.php: -------------------------------------------------------------------------------- 1 | '127.0.0.1', 9 | 'user' => 'root', 10 | 'password' => 'root', 11 | 'database' => 'test', 12 | ); 13 | 14 | echo "connect\n"; 15 | $ret1 = $db->connect($server); 16 | var_dump($ret1); 17 | 18 | echo "prepare [1]\n"; 19 | $stmt1 = $db->prepare('show tables'); 20 | echo "execute\n"; 21 | $ret1 = $stmt1->execute([]); 22 | var_dump($ret1); 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /examples/coroutine/mysql_query.php: -------------------------------------------------------------------------------- 1 | 1]); 4 | 5 | co::create(function() { 6 | 7 | 8 | $function = new ReflectionFunction('title'); 9 | 10 | $function->invoke(); 11 | echo "invoke444\n"; 12 | 13 | }); 14 | 15 | function title() { 16 | echo "333invoke_________________________________\n"; 17 | $tcpclient = new Swoole\Coroutine\Client(SWOOLE_SOCK_TCP); 18 | var_dump($tcpclient->connect('127.0.0.1', 9501, 1)); 19 | 20 | } 21 | 22 | echo "111\n"; 23 | 24 | 25 | echo "222\n"; 26 | co::go(); 27 | -------------------------------------------------------------------------------- /examples/coroutine/mysql_unixsocket.php: -------------------------------------------------------------------------------- 1 | 'unix:/tmp/mysql.sock', 7 | 'user' => 'root', 8 | 'password' => 'root', 9 | 'database' => 'test' 10 | ]; 11 | $db->connect($server); 12 | $stmt = $db->prepare('SELECT * FROM `user` WHERE id=?'); 13 | $ret = $stmt->execute([1]); 14 | var_dump($ret); 15 | }); 16 | -------------------------------------------------------------------------------- /examples/coroutine/pdo/pdo_persistent.phpt: -------------------------------------------------------------------------------- 1 | true) 7 | ); 8 | echo "connected\n"; 9 | sleep(30); 10 | echo "sleep 30\n"; 11 | $pdo->exec("SELECT sleep(1)"); 12 | }); 13 | 14 | echo "DONE\n"; 15 | -------------------------------------------------------------------------------- /examples/coroutine/proc_open.php: -------------------------------------------------------------------------------- 1 | array("pipe", "r"), 7 | 1 => array("pipe", "w"), 8 | 2 => array("pipe", "w"), 9 | ); 10 | 11 | $process = proc_open('unknown', $descriptorspec, $pipes); 12 | 13 | var_dump($pipes); 14 | 15 | var_dump(fread($pipes[2], 8192)); 16 | 17 | $return_value = proc_close($process); 18 | 19 | echo "command returned $return_value\n"; 20 | }); -------------------------------------------------------------------------------- /examples/coroutine/redis/auth.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379); 5 | $redis->auth('root'); 6 | $redis->set('key', 'swoole redis work'); 7 | var_dump($redis->get('key')); 8 | }); 9 | -------------------------------------------------------------------------------- /examples/coroutine/redis/eval.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379); 5 | $res = $redis->eval("return redis.call('get', 'key')"); 6 | var_dump($res); 7 | }); 8 | -------------------------------------------------------------------------------- /examples/coroutine/redis/get.php: -------------------------------------------------------------------------------- 1 | connect("127.0.0.1", 6379)); 5 | var_dump($redis->get("key")); 6 | var_dump($redis->set("key_22", str_repeat('A', 8192*256))); 7 | var_dump($redis->mget(["key", "key_22"])); 8 | }); 9 | -------------------------------------------------------------------------------- /examples/coroutine/redis/multi.php: -------------------------------------------------------------------------------- 1 | connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT); 9 | $redis->multi(); 10 | $redis->set('key3', 'rango'); 11 | $redis->get('key1'); 12 | $redis->get('key2'); 13 | $redis->get('key3'); 14 | 15 | $result = $redis->exec(); 16 | var_dump($result); 17 | }); 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/coroutine/redis/pipeline.php: -------------------------------------------------------------------------------- 1 | connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT); 9 | $redis->setDefer(); 10 | $redis->set('key1', 'value'); 11 | $redis->get('key1'); 12 | 13 | $result1 = $redis->recv(); 14 | $result2 = $redis->recv(); 15 | 16 | var_dump($result1, $result2); 17 | }); 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/coroutine/redis/pub.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379); 6 | while (true) 7 | { 8 | $msg = $redis->publish('msg_1', 'hello-' . $i++); 9 | var_dump($msg); 10 | co::sleep(1); 11 | } 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /examples/coroutine/redis/request.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379); 5 | $res = $redis->request(['object', 'encoding', 'key1']); 6 | var_dump($res); 7 | }); 8 | -------------------------------------------------------------------------------- /examples/coroutine/redis/serialize.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379, true); // param3 is serialize 6 | $redis->set('foo', ['bar' => 'baz']); 7 | $ret = $redis->get('foo'); 8 | var_dump($ret); 9 | }); 10 | -------------------------------------------------------------------------------- /examples/coroutine/redis/sub.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379); 5 | $msg = $redis->subscribe(array("msg_1")); 6 | while ($msg = $redis->recv()) 7 | { 8 | var_dump($msg); 9 | } 10 | }); 11 | 12 | go(function () { 13 | $redis = new Swoole\Coroutine\Redis(); 14 | $redis->connect('127.0.0.1', 6379); 15 | $msg = $redis->subscribe(array("msg_2")); 16 | while ($msg = $redis->recv()) 17 | { 18 | var_dump($msg); 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /examples/coroutine/redis_subscribe.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 6379); 8 | while (true) 9 | { 10 | $val = $redis->subscribe(['test']); 11 | //订阅的channel,以第一次调用subscribe时的channel为准,后续的subscribe调用是为了收取Redis Server的回包 12 | //如果需要改变订阅的channel,请close掉连接,再调用subscribe 13 | var_dump($val); 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /examples/coroutine/scheduler.php: -------------------------------------------------------------------------------- 1 | pop(); 10 | echo "pop [#$i] ret:".var_export($ret,1)."\n"; 11 | } 12 | }); 13 | 14 | go(function () use ($c1,$num) { 15 | echo "push start\n"; 16 | for ($i=0;$i<$num;$i++) 17 | { 18 | $ret = $c1->push("data-$i"); 19 | echo "push [#$i] ret:".var_export($ret,1)."\n"; 20 | } 21 | 22 | }); 23 | echo "main end\n"; 24 | -------------------------------------------------------------------------------- /examples/coroutine/select/4.php: -------------------------------------------------------------------------------- 1 | push("data-$i"); 10 | echo "push [#$i] ret:".var_export($ret,1)."\n"; 11 | } 12 | }); 13 | 14 | go(function () use ($c1, $num) { 15 | echo "pop start\n"; 16 | for ($i=0;$i<$num;$i++) 17 | { 18 | $ret = $c1->pop(); 19 | echo "pop [#$i] ret:".var_export($ret,1)."\n"; 20 | } 21 | }); 22 | echo "main end\n"; 23 | -------------------------------------------------------------------------------- /examples/coroutine/select/9.php: -------------------------------------------------------------------------------- 1 | push("chan1-$i"); 9 | echo "chan push [#$i] ret:".var_export($ret,1)."\n"; 10 | } 11 | }); 12 | 13 | go(function () use ($c1) { 14 | $ret = $c1->pop(); 15 | echo "chan pop ret:".var_export($ret,1)."\n"; 16 | co::sleep(1); 17 | $ret = $c1->pop(); 18 | echo "chan pop ret:".var_export($ret,1)."\n"; 19 | }); 20 | -------------------------------------------------------------------------------- /examples/coroutine/select/poptimeout.php: -------------------------------------------------------------------------------- 1 | pop(1); 9 | $end = microtime(1); 10 | echo "chan pop ret:".var_export($ret,1)." error:".$c1->errCode."\n"; 11 | echo "use time:".($end-$start)."s\n"; 12 | 13 | }); 14 | 15 | go(function () use ($c1) { 16 | co::sleep(2); 17 | echo "sleep 2\n"; 18 | $ret = $c1->push("chan-1"); 19 | echo "chan push ret:".var_export($ret,1)." error:".$c1->errCode."\n"; 20 | }); 21 | -------------------------------------------------------------------------------- /examples/coroutine/select/test.php: -------------------------------------------------------------------------------- 1 | push($i); 9 | echo "push {$i} res:".var_export($ret, 1)."\n"; 10 | }); 11 | }; 12 | go(function ()use ($chan){ 13 | $bool = true; 14 | while ($bool){ 15 | $data = $chan->pop(); 16 | echo "pop res:".var_export($data, 1)."\n"; 17 | if($data===false){ 18 | $bool = false; 19 | } 20 | //var_dump($data); 21 | } 22 | }); 23 | -------------------------------------------------------------------------------- /examples/coroutine/server/tcp.php: -------------------------------------------------------------------------------- 1 | handle(function (Connection $conn) { 10 | while (true) { 11 | 12 | $data = $conn->recv(); 13 | if (!$data) { 14 | break; 15 | } 16 | $conn->send("hello $data"); 17 | } 18 | $conn->close(); 19 | }); 20 | 21 | $server->start(); 22 | }); 23 | 24 | Swoole\Event::wait(); 25 | -------------------------------------------------------------------------------- /examples/coroutine/sleep.php: -------------------------------------------------------------------------------- 1 | set([ 5 | 'worker_num' => 1, 6 | ]); 7 | 8 | $server->on('Request', function ($request, $response) { 9 | Swoole\Coroutine::sleep(0.2); 10 | $response->end('Test End'); 11 | }); 12 | 13 | $server->start(); 14 | -------------------------------------------------------------------------------- /examples/coroutine/socket/accept.php: -------------------------------------------------------------------------------- 1 | bind('127.0.0.1', 9601); 5 | var_dump($ret); 6 | assert($sock->listen(512)); 7 | $conn = $sock->accept(); 8 | 9 | $data = $conn->recv(); 10 | var_dump($data); 11 | $json = json_decode($data, true); 12 | var_dump($json); 13 | $ret = $conn->send("world\n"); 14 | echo "send res {$ret} \n"; 15 | $conn->close(); 16 | }); 17 | -------------------------------------------------------------------------------- /examples/coroutine/socket/sendto.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9601); 7 | echo "connect ret:".var_export($ret,1)." error:".var_export($conn->errCode,1)."\n"; 8 | $ret = $conn->send(json_encode(['data' => 'hello'])); 9 | echo "send ret:".var_export($ret,1)."\n"; 10 | echo $conn->recv(); 11 | }); 12 | echo "end \n"; 13 | -------------------------------------------------------------------------------- /examples/coroutine/stack.php: -------------------------------------------------------------------------------- 1 | 8192*4]); 3 | 4 | function test($n) 5 | { 6 | $a = 1; 7 | $b = 2; 8 | $c = 3; 9 | $d = 4; 10 | static $i; 11 | 12 | usleep(100000); 13 | echo "index=".($i++)."\n"; 14 | 15 | return test($n + $a + $b + $c + $d); 16 | } 17 | 18 | go(function () { 19 | test(9); 20 | }); 21 | -------------------------------------------------------------------------------- /examples/coroutine/stack/2.php: -------------------------------------------------------------------------------- 1 | set(array( 4 | 'worker_num' => 1, //工作进程数量 5 | 'daemonize' => true, //是否作为守护进程 6 | )); 7 | $serv->on('connect', function ($serv, $fd){ 8 | echo "Client:Connect.\n"; 9 | }); 10 | $serv->on('receive', function ($serv, $fd, $reactor_id, $data) { 11 | $serv->send($fd, 'Swoole: '.$data); 12 | $serv->close($fd); 13 | }); 14 | $serv->on('close', function ($serv, $fd) { 15 | echo "Client: Close.\n"; 16 | }); 17 | $serv->start(); 18 | -------------------------------------------------------------------------------- /examples/coroutine/timer_test.php: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /examples/coroutine/util/resume001.php: -------------------------------------------------------------------------------- 1 | set(['worker_num' => 8, ]); 5 | 6 | $http->on("start", function ($server) { 7 | echo "Swoole http server is started at http://127.0.0.1:9501\n"; 8 | }); 9 | 10 | $http->on("request", function ($request, $response) { 11 | sleep(1); 12 | $response->end("Hello World\n"); 13 | }); 14 | 15 | $http->start(); 16 | -------------------------------------------------------------------------------- /examples/dtls/client.php: -------------------------------------------------------------------------------- 1 | connect("127.0.0.1", 9905); 8 | echo "connect OK\n"; 9 | $client->send("hello world"); 10 | echo $client->recv(); 11 | $client->close(); 12 | echo "END\n"; 13 | } 14 | ); -------------------------------------------------------------------------------- /examples/event/cycle.php: -------------------------------------------------------------------------------- 1 | \n"); 5 | } 6 | fwrite($fp, "HELLO world"); 7 | 8 | function stream_onRead($fp) 9 | { 10 | echo fread($fp, 1024)."\n"; 11 | sleep(1); 12 | Swoole\Event::write($fp, "hello world"); 13 | //Swoole\Event::set($fp, null, null, SWOOLE_EVENT_READ | SWOOLE_EVENT_WRITE); 14 | //Swoole\Event::del($fp); 15 | //fclose($fp); 16 | } 17 | 18 | 19 | Swoole\Event::add($fp, 'stream_onRead'); 20 | 21 | echo "start\n"; 22 | Swoole\Event::wait(); 23 | -------------------------------------------------------------------------------- /examples/event/test.php: -------------------------------------------------------------------------------- 1 | on('request', function ($req, Swoole\Http\Response $resp) use ($http) { 6 | if ($req->server['request_uri'] == '/') { 7 | $resp->header('Content-Encoding', ''); 8 | $resp->end(str_repeat('A', 1024)); 9 | } elseif ($req->server['request_uri'] == '/gzip') { 10 | $resp->end(str_repeat('A', 1024)); 11 | } else { 12 | $resp->status(404); 13 | $resp->end(); 14 | } 15 | }); 16 | 17 | $http->start(); 18 | -------------------------------------------------------------------------------- /examples/http/post.data: -------------------------------------------------------------------------------- 1 | dd=wwwwww&ddd=eee&3412=3234&hello=world%2C+i+am+rango%2C+thank+you.+no+body 2 | -------------------------------------------------------------------------------- /examples/http/raw.php: -------------------------------------------------------------------------------- 1 | on('request', function ($req, Swoole\Http\Response $resp) { 5 | $resp->redirect("http://www.baidu.com/", 301); 6 | }); 7 | 8 | $http->start(); 9 | -------------------------------------------------------------------------------- /examples/http/static_handler.php: -------------------------------------------------------------------------------- 1 | set([ 5 | 'enable_static_handler' => true, 6 | 'http_autoindex' => true, 7 | 'document_root' => realpath(__DIR__.'/../www/'), 8 | ]); 9 | 10 | $http->on('request', function ($req, $resp) { 11 | $resp->end("hello world\n"); 12 | }); 13 | 14 | $http->start(); 15 | -------------------------------------------------------------------------------- /examples/http/test.txt: -------------------------------------------------------------------------------- 1 | hello world! 2 | -------------------------------------------------------------------------------- /examples/http2/streaming.php: -------------------------------------------------------------------------------- 1 | set([ 5 | 'open_http2_protocol' => 1, 6 | ]); 7 | 8 | /** 9 | * nghttp -v http://localhost:9501 10 | */ 11 | $http->on('request', function (Swoole\Http\Request $request, Swoole\Http\Response $response) { 12 | $n = 5; 13 | while ($n--) { 14 | $response->write("hello world, #$n
\n"); 15 | Co\System::sleep(1); 16 | } 17 | $response->end("hello world"); 18 | }); 19 | 20 | $http->start(); 21 | 22 | -------------------------------------------------------------------------------- /examples/http2/test.html: -------------------------------------------------------------------------------- 1 |

Test

2 | -------------------------------------------------------------------------------- /examples/ipv6/tcp_client.php: -------------------------------------------------------------------------------- 1 | connect('::1', 9501, -1)) 4 | { 5 | exit("connect failed. Error: {$client->errCode}\n"); 6 | } 7 | 8 | var_dump($client->getsockname()); 9 | 10 | for($i=0; $i < 1; $i ++) 11 | { 12 | $client->send("hello world\n"); 13 | echo $client->recv(); 14 | usleep(2000); 15 | } 16 | 17 | $client->close(); 18 | -------------------------------------------------------------------------------- /examples/ipv6/udp_client.php: -------------------------------------------------------------------------------- 1 | connect('::1', 9502); 4 | $client->send("admin"); 5 | echo $client->recv()."\n"; 6 | var_dump($client->getsockname()); 7 | var_dump($client->getpeername()); 8 | $client->sendto('::1', 9502, "admin2"); 9 | echo $client->recv()."\n"; 10 | sleep(1); 11 | -------------------------------------------------------------------------------- /examples/ipv6/udp_server.php: -------------------------------------------------------------------------------- 1 | set(array( 4 | 'worker_num' => 1, 5 | )); 6 | $serv->on('receive', function (Swoole\Server $serv, $fd, $reactor_id, $data) { 7 | echo "[#".posix_getpid()."]\tClient[$fd]: $data\n"; 8 | var_dump($serv->connection_info($fd, $reactor_id)); 9 | $serv->send($fd, json_encode(array("hello" => '1213', "bat" => "ab"))); 10 | //$serv->close($fd); 11 | }); 12 | $serv->start(); 13 | -------------------------------------------------------------------------------- /examples/length/config.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /examples/multicast/client.php: -------------------------------------------------------------------------------- 1 | connect('224.10.20.30', 9905); 4 | $client->send("hello world"); 5 | echo $client->recv() . "\n"; 6 | sleep(1); 7 | -------------------------------------------------------------------------------- /examples/php/error.php: -------------------------------------------------------------------------------- 1 | test(); 4 | -------------------------------------------------------------------------------- /examples/php/exception.php: -------------------------------------------------------------------------------- 1 | 1, 'usec' => 500000); 11 | socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,$timeout); 12 | 13 | $n = socket_recv($socket, $buf, 2048, MSG_WAITALL); 14 | 15 | var_dump($n, $buf); 16 | -------------------------------------------------------------------------------- /examples/php/stream_client.php: -------------------------------------------------------------------------------- 1 | \n"; 5 | } else { 6 | fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n"); 7 | sleep(1000); 8 | fclose($fp); 9 | } 10 | -------------------------------------------------------------------------------- /examples/php/tick.php: -------------------------------------------------------------------------------- 1 | 20) 8 | { 9 | Swoole\Process::alarm(-1); 10 | } 11 | }); 12 | 13 | Swoole\Process::alarm(100 * 1000); 14 | -------------------------------------------------------------------------------- /examples/process/client.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 8089, -1)) 5 | { 6 | exit("connect failed. Error: {$client->errCode}\n"); 7 | } 8 | 9 | function _send(Swoole\Client $client, $data) 10 | { 11 | return $client->send(pack('N', strlen($data)) . $data); 12 | } 13 | 14 | var_dump($client->getsockname()); 15 | 16 | 17 | _send($client, "hello world"); 18 | _send($client, "hello world [2]"); 19 | 20 | $client->close(); 21 | -------------------------------------------------------------------------------- /examples/process/client3.php: -------------------------------------------------------------------------------- 1 | 'hello', 'uid' => 1991]); 4 | fwrite($fp, pack('N', strlen($msg)) . $msg); 5 | sleep(1); 6 | var_dump(fread($fp, 8192)); 7 | fclose($fp); 8 | -------------------------------------------------------------------------------- /examples/process/close.php: -------------------------------------------------------------------------------- 1 | pid . "\n"; 5 | sleep(2); 6 | $worker->close(Swoole\Process::PIPE_READ); 7 | $worker->write("hello master\n"); 8 | $worker->exit(0); 9 | }, false); 10 | 11 | $pid = $process->start(); 12 | $r = array($process); 13 | $w = array(); 14 | $e = array(); 15 | $ret = swoole_select($r, $w, $e, 1.0); 16 | var_dump($ret); 17 | var_dump($process->read()); 18 | -------------------------------------------------------------------------------- /examples/process/daemon.php: -------------------------------------------------------------------------------- 1 | start(); 4 | 5 | function callback_function(Swoole\Process $worker) 6 | { 7 | $worker->exec('/usr/local/bin/php', array(__DIR__.'/stdin_stdout.php')); 8 | } 9 | 10 | echo "From Worker: ".$process->read(); 11 | $process->write("hello worker\n"); 12 | echo "From Worker: ".$process->read(); 13 | 14 | $ret = Swoole\Process::wait(); 15 | var_dump($ret); 16 | -------------------------------------------------------------------------------- /examples/process/msg_pop.php: -------------------------------------------------------------------------------- 1 | on('Message', function (Pool $pool, string $data) { 6 | var_dump($data); 7 | }); 8 | $pool->start(); 9 | -------------------------------------------------------------------------------- /examples/process/msg_push.php: -------------------------------------------------------------------------------- 1 | push($msg); 5 | var_dump($ret); 6 | -------------------------------------------------------------------------------- /examples/process/msgqueue_client.php: -------------------------------------------------------------------------------- 1 | stats()); 8 | } 9 | elseif ($i % 300 == 299) 10 | { 11 | sleep(1); 12 | } 13 | $mq->push("hello $i"); 14 | } 15 | -------------------------------------------------------------------------------- /examples/process/msgqueue_pool.php: -------------------------------------------------------------------------------- 1 | on("Message", function ($pool, $message) { 5 | echo "Message: {$message}\n"; 6 | }); 7 | 8 | $pool->on("WorkerStart", function ($pool, $workerId) { 9 | echo "Worker#{$workerId} is started\n"; 10 | }); 11 | 12 | $pool->on("WorkerStop", function ($pool, $workerId) { 13 | echo "Worker#{$workerId} is stopped\n"; 14 | }); 15 | 16 | $pool->start(); 17 | -------------------------------------------------------------------------------- /examples/process/pool_socket.php: -------------------------------------------------------------------------------- 1 | on("Message", function ($pool, $message) { 5 | echo "Message: {$message}\n"; 6 | $pool->write("hello "); 7 | $pool->write("world "); 8 | $pool->write("\n"); 9 | }); 10 | 11 | $pool->listen('127.0.0.1', 8089); 12 | 13 | $pool->start(); 14 | -------------------------------------------------------------------------------- /examples/process/python.php: -------------------------------------------------------------------------------- 1 | start(); 4 | 5 | function pyhon_process(Swoole\Process $worker) 6 | { 7 | $worker->exec('/usr/bin/python', array("echo.py")); 8 | } 9 | 10 | $process->write("hello world\n"); 11 | echo $process->read(); 12 | 13 | $ret = Swoole\Process::wait(); 14 | var_dump($ret); 15 | -------------------------------------------------------------------------------- /examples/process/select.php: -------------------------------------------------------------------------------- 1 | pid . "\n"; 5 | sleep(2); 6 | $worker->write("hello master\n"); 7 | $worker->exit(0); 8 | }, false); 9 | 10 | $pid = $process->start(); 11 | $r = array($process); 12 | $ret = swoole_select($r, null, null, 1.0); 13 | var_dump($ret); 14 | var_dump($process->read()); 15 | -------------------------------------------------------------------------------- /examples/process/set_cpu_affinity.php: -------------------------------------------------------------------------------- 1 | 'hello', 'uid' => 1991]); 4 | fwrite($fp, pack('N', strlen($msg)) . $msg); 5 | sleep(1); 6 | -------------------------------------------------------------------------------- /examples/runtime/curl.php: -------------------------------------------------------------------------------- 1 | query("select sleep(1) s"); 10 | var_dump($res->fetchAll()); 11 | $dbh = null; 12 | } catch (PDOException $exception) { 13 | echo $exception->getMessage(); 14 | exit; 15 | } 16 | } 17 | 18 | Co::set(['trace_flags' => SWOOLE_TRACE_CO_ODBC, 'log_level' => SWOOLE_LOG_DEBUG]); 19 | 20 | Co\run(function () { 21 | test(); 22 | }); 23 | -------------------------------------------------------------------------------- /examples/runtime/read.php: -------------------------------------------------------------------------------- 1 | SWOOLE_HOOK_PDO_SQLITE]); 6 | 7 | run(function() { 8 | $db = new PDO('sqlite::memory:'); 9 | for ($i = 0; $i < 10; $i++) { 10 | go(function() use($i, $db) { 11 | $db->query('select randomblob(99999999)'); 12 | var_dump($i); 13 | }); 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /examples/runtime/ssl.php: -------------------------------------------------------------------------------- 1 | \n"; 8 | } else { 9 | $http = "GET / HTTP/1.0\r\nAccept: */*User-Agent: Lowell-Agent\r\nHost: www.baidu.com\r\nConnection: Close\r\n\r\n"; 10 | fwrite($fp, $http); 11 | while (!feof($fp)) { 12 | echo fgets($fp, 1024); 13 | } 14 | fclose($fp); 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /examples/runtime/stream.php: -------------------------------------------------------------------------------- 1 | \n"; 7 | } else { 8 | fwrite($fp, "GET / HTTP/1.0\r\nHost: www.baidu.com\r\nAccept: */*\r\n\r\n"); 9 | while (!feof($fp)) { 10 | echo fgets($fp, 1024); 11 | } 12 | fclose($fp); 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /examples/runtime/sync.php: -------------------------------------------------------------------------------- 1 | set(array( 5 | 'dispatch_func' => function ($serv, $fd, $type, $data) { 6 | var_dump($fd, $type, $data); 7 | return intval($data[0]); 8 | }, 9 | )); 10 | 11 | $serv->on('receive', function (Swoole\Server $serv, $fd, $threadId, $data) 12 | { 13 | var_dump($data); 14 | echo "#{$serv->worker_id}>> received length=" . strlen($data) . "\n"; 15 | }); 16 | 17 | $serv->start(); 18 | -------------------------------------------------------------------------------- /examples/server/dispatch_stream.php: -------------------------------------------------------------------------------- 1 | set(array( 5 | 'dispatch_mode' => 7, 6 | 'worker_num' => 2, 7 | )); 8 | 9 | $serv->on('receive', function (Swoole\Server $serv, $fd, $threadId, $data) 10 | { 11 | var_dump($data); 12 | echo "#{$serv->worker_id}>> received length=" . strlen($data) . "\n"; 13 | $serv->send($fd, "Swoole $data\n"); 14 | }); 15 | 16 | $serv->start(); 17 | -------------------------------------------------------------------------------- /examples/server/hot_update_class.php: -------------------------------------------------------------------------------- 1 | listen("127.0.0.1", $port, SWOOLE_SOCK_TCP); 7 | } 8 | 9 | $serv->on("receive", function($serv, $fd, $reactor_id, $data) { 10 | $info = $serv->getClientInfo($fd); 11 | var_dump($info); 12 | }); 13 | 14 | $serv->start(); 15 | -------------------------------------------------------------------------------- /examples/server/reload_force.php: -------------------------------------------------------------------------------- 1 | set([ 5 | "worker_num" => 4, 6 | "max_wait_time" => 1 7 | ]); 8 | $serv->on("WorkerStart", function (\Swoole\Server $server, $worker_id) { 9 | global $flag; 10 | echo "$worker_id [".$server->worker_pid."] start \n"; 11 | }); 12 | $serv->on('receive', function ($serv, $fd, $tid, $data) { 13 | echo "$tid recv $data\n"; 14 | if ($data) { 15 | sleep(100); 16 | } 17 | }); 18 | $serv->start(); 19 | -------------------------------------------------------------------------------- /examples/server/reload_force2.php: -------------------------------------------------------------------------------- 1 | set([ 5 | "worker_num" => 4, 6 | "max_wait_time" => 1 7 | ]); 8 | $serv->on("WorkerStart", function (\Swoole\Server $server, $worker_id) { 9 | global $flag; 10 | echo "$worker_id [".$server->worker_pid."] start \n"; 11 | }); 12 | $serv->on('receive', function ($serv, $fd, $tid, $data) { 13 | echo "$tid recv $data\n"; 14 | if ($data) { 15 | sleep(100); 16 | } 17 | }); 18 | $serv->start(); 19 | -------------------------------------------------------------------------------- /examples/server/single.php: -------------------------------------------------------------------------------- 1 | on('Receive', function($serv, $fd, $reactor_id, $data) { 6 | $serv->send($fd, "Swoole: $data"); 7 | }); 8 | 9 | $server->start(); 10 | -------------------------------------------------------------------------------- /examples/socket_coro/client.php: -------------------------------------------------------------------------------- 1 | connect('localhost', 9601); 6 | while ($retval) 7 | { 8 | $n = $socket->send("hello"); 9 | var_dump($n); 10 | 11 | $data = $socket->recv(); 12 | var_dump($data); 13 | 14 | if (empty($data)) { 15 | $socket->close(); 16 | break; 17 | } 18 | co::sleep(1.0); 19 | } 20 | var_dump($retval, $socket->errCode); 21 | }); 22 | -------------------------------------------------------------------------------- /examples/ssl/co_client.php: -------------------------------------------------------------------------------- 1 | set(['ssl_host_name' => 'pro-api.coinmarketcap.com']); 5 | $c->get('/'); 6 | var_dump($c->body, $c->headers); 7 | }); 8 | -------------------------------------------------------------------------------- /examples/ssl/gen_cert.md: -------------------------------------------------------------------------------- 1 | ```shell 2 | openssl genrsa -out ssl.key 2048 3 | openssl req -new -key ssl.key -out ssl.csr 4 | openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt 5 | ``` -------------------------------------------------------------------------------- /examples/ssl/http_client.php: -------------------------------------------------------------------------------- 1 | setHeaders(array('User-Agent' => 'swoole-http-client')); 4 | 5 | $cli->on('close', function($_cli) { 6 | echo "connection is closed\n"; 7 | }); 8 | $cli->get('/?dump.php?corpid=ding880f44069a80bca1&corpsecret=YB1cT8FNeN7VCm3eThwDAncsmSl4Ajl_1DmckaOFmOZhTFzexLbIzq5ueH3YcHrx', function ($cli) { 9 | var_dump($cli); 10 | var_dump($cli->headers); 11 | echo $cli->body; 12 | //$cli->close(); 13 | }); 14 | -------------------------------------------------------------------------------- /examples/ssl/passphrase.php: -------------------------------------------------------------------------------- 1 | set(array( 4 | "ssl_key_file" => __DIR__ . '/ssl.key', 5 | "ssl_cert_file" => __DIR__ . '/ssl.crt', 6 | 'ssl_passphrase' => '5524001', 7 | )); 8 | if (!$client->connect('127.0.0.1', 9501, -1)) 9 | { 10 | exit("connect failed. Error: {$client->errCode}\n"); 11 | } 12 | echo "connect ok\n"; 13 | sleep(1); 14 | 15 | for ($i = 0; $i < 1000; $i++) 16 | { 17 | $client->send("hello world-" . str_repeat('A', $i) . "\n"); 18 | echo $client->recv(); 19 | } 20 | sleep(1); 21 | -------------------------------------------------------------------------------- /examples/ssl/swoole.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoole/swoole-src/7c6764d5cd6dbfbefa93d78e35d710226ecbc662/examples/ssl/swoole.log -------------------------------------------------------------------------------- /examples/ssl/websocket_client.html: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /examples/table/usage.php: -------------------------------------------------------------------------------- 1 | column('id', Swoole\Table::TYPE_INT); 4 | $table->column('name', Swoole\Table::TYPE_STRING, 64); 5 | $table->column('num', Swoole\Table::TYPE_FLOAT); 6 | $table->create(); 7 | 8 | $table->set('a', array('id' => 1, 'name' => 'swoole-co-uk', 'num' => 3.1415)); 9 | $table->set('b', array('id' => 2, 'name' => "swoole-uk", 'num' => 3.1415)); 10 | $table->set('hello@swoole.co.uk', array('id' => 3, 'name' => 'swoole', 'num' => 3.1415)); 11 | 12 | var_dump($table->get('a')); 13 | var_dump($table->get('b', 'name')); 14 | -------------------------------------------------------------------------------- /examples/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoole/swoole-src/7c6764d5cd6dbfbefa93d78e35d710226ecbc662/examples/test.jpg -------------------------------------------------------------------------------- /examples/thread/argv.php: -------------------------------------------------------------------------------- 1 | join(); 13 | } 14 | } else { 15 | var_dump($args[0], $args[1], $args[2]); 16 | sleep(1); 17 | } 18 | -------------------------------------------------------------------------------- /examples/thread/array.php: -------------------------------------------------------------------------------- 1 | lock(); 11 | $thread = new Thread(__FILE__, $lock); 12 | echo "main thread\n"; 13 | $lock->unlock(); 14 | $thread->join(); 15 | var_dump($thread->getExitStatus()); 16 | } else { 17 | $lock = $args[0]; 18 | $lock->lock(); 19 | sleep(1); 20 | exit(234); 21 | } 22 | -------------------------------------------------------------------------------- /examples/thread/lock.php: -------------------------------------------------------------------------------- 1 | lock(); 11 | $thread = new Thread(__FILE__, $lock); 12 | $lock->lock(); 13 | echo "main thread\n"; 14 | $thread->join(); 15 | } else { 16 | $lock = $args[0]; 17 | sleep(1); 18 | $lock->unlock(); 19 | } 20 | -------------------------------------------------------------------------------- /examples/thread/map.php: -------------------------------------------------------------------------------- 1 | random_int(1, 999999999999999999), 8 | 'b' => random_bytes(128), 9 | 'c' => uniqid(), 10 | 'd' => time(), 11 | ]; 12 | 13 | $map = new Thread\Map($array); 14 | $thread = new Thread(__FILE__, $map); 15 | } else { 16 | $map = $args[0]; 17 | var_dump($map->toArray()); 18 | } 19 | -------------------------------------------------------------------------------- /examples/thread/nested_map.php: -------------------------------------------------------------------------------- 1 | uniqid(), 13 | 'b' => random_int(1000, 9999), 14 | ]; 15 | 16 | var_dump($map['map1']['key1']); 17 | var_dump($map['list1'][0]); 18 | 19 | var_dump($map['list1']->toArray()); 20 | 21 | var_dump($map['map2']); 22 | -------------------------------------------------------------------------------- /examples/thread/pipe.php: -------------------------------------------------------------------------------- 1 | recv(8192), PHP_EOL; 12 | $thread->join(); 13 | }); 14 | } else { 15 | $sockets = $args[0]; 16 | Co\run(function () use ($sockets) { 17 | sleep(1); 18 | $sockets[1]->send(uniqid()); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /examples/thread/run_test.php: -------------------------------------------------------------------------------- 1 | join(); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /examples/thread/socket.php: -------------------------------------------------------------------------------- 1 | join(); 17 | } else { 18 | $map = $args[0]; 19 | $sock = $map['socket']; 20 | $retval = socket_connect($sock, '127.0.0.1', 80); 21 | } 22 | -------------------------------------------------------------------------------- /examples/thread/test.php: -------------------------------------------------------------------------------- 1 | uuid = uniqid(); 11 | $map['obj'] = $o; 12 | 13 | var_dump($map['obj']); 14 | 15 | $s = serialize($map); 16 | var_dump(unserialize($s)); 17 | 18 | -------------------------------------------------------------------------------- /examples/timer/clear.php: -------------------------------------------------------------------------------- 1 | false 4 | ]); 5 | Swoole\Timer::tick(1000, function () { 6 | $uid = Co::getuid(); 7 | assert($uid === -1); 8 | echo "#{$uid}\n"; 9 | }); 10 | -------------------------------------------------------------------------------- /examples/udp/client.php: -------------------------------------------------------------------------------- 1 | connect('127.0.0.1', 9905); 4 | $client->send(serialize(['hello' => str_repeat('A', 600), 'rand' => rand(1, 100)])); 5 | echo $client->recv() . "\n"; 6 | sleep(1); 7 | -------------------------------------------------------------------------------- /examples/udp/server.php: -------------------------------------------------------------------------------- 1 | listen('0.0.0.0', 9906 + $i, SWOOLE_SOCK_UDP); 6 | } 7 | $server->set(['worker_num' => 4]); 8 | 9 | $server->on('Packet', function (Swoole\Server $serv, $data, $addr) 10 | { 11 | $serv->sendto($addr['address'], $addr['port'], "Swoole: $data", $addr['server_socket']); 12 | }); 13 | 14 | $server->start(); 15 | -------------------------------------------------------------------------------- /examples/unixsock/dgram_client.php: -------------------------------------------------------------------------------- 1 | connect(__DIR__ . '/svr.sock', 0, -1)) 4 | { 5 | exit("connect failed. Error: {$client->errCode}\n"); 6 | } 7 | 8 | $client->send("hello world\n"); 9 | echo $client->recv(); 10 | $client->close(); 11 | 12 | sleep(1); 13 | -------------------------------------------------------------------------------- /examples/unixsock/stream_client.php: -------------------------------------------------------------------------------- 1 | connect(__DIR__.'/svr.sock', 0, -1)) 4 | { 5 | exit("connect failed. Error: {$client->errCode}\n"); 6 | } 7 | 8 | $client->send("hello world\n"); 9 | echo $client->recv(); 10 | $client->close(); 11 | 12 | sleep(1); 13 | -------------------------------------------------------------------------------- /examples/websocket/client.html: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /examples/www/dir1/file1.txt: -------------------------------------------------------------------------------- 1 | dir1/file1 -------------------------------------------------------------------------------- /examples/www/dir1/file2.txt: -------------------------------------------------------------------------------- 1 | dir1/file2 -------------------------------------------------------------------------------- /examples/www/dir2/file1.txt: -------------------------------------------------------------------------------- 1 | dir2/file1 -------------------------------------------------------------------------------- /examples/www/dir2/file2.txt: -------------------------------------------------------------------------------- 1 | dir2/file2.txt -------------------------------------------------------------------------------- /examples/www/dir2/index.txt: -------------------------------------------------------------------------------- 1 | dir2/index.txt -------------------------------------------------------------------------------- /examples/www/file1.txt: -------------------------------------------------------------------------------- 1 | file1.txt -------------------------------------------------------------------------------- /examples/www/file2.txt: -------------------------------------------------------------------------------- 1 | file2 -------------------------------------------------------------------------------- /examples/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | index.html 7 | 8 | -------------------------------------------------------------------------------- /examples/www/index.txt: -------------------------------------------------------------------------------- 1 | index.txt -------------------------------------------------------------------------------- /ext-src/stubs/php_swoole_channel_coro.stub.php: -------------------------------------------------------------------------------- 1 | swoole_version(), 4 | 'cpu_num' => swoole_cpu_num(), 5 | 'local_mac' => swoole_get_local_mac(), 6 | 'local_ip' => swoole_get_local_ip() 7 | ]); 8 | -------------------------------------------------------------------------------- /scripts/debug/swoole_table_implements.php: -------------------------------------------------------------------------------- 1 | /dev/null && \ 7 | phpize --clean > /dev/null && \ 8 | phpize > /dev/null && \ 9 | ./configure > /dev/null && \ 10 | make -j8 > /dev/null | tee /tmp/compile.log && \ 11 | (test "`cat /tmp/compile.log`"x = ""x || exit 255) && \ 12 | make install && \ 13 | echo "\n[swoole]\nextension=swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini 14 | -------------------------------------------------------------------------------- /tests/CONTRIBUTION: -------------------------------------------------------------------------------- 1 | Tianfeng Han @ Swoole Group 2 | Twosee @ Swoole Group 3 | Xiaofeng Chu @ Zan Group 4 | -------------------------------------------------------------------------------- /tests/include/api/swoole_client/connect_timeout.php: -------------------------------------------------------------------------------- 1 | on("connect", function(Swoole\Client $cli) { 4 | Assert::true(false, 'never here'); 5 | }); 6 | $cli->on("receive", function(Swoole\Client $cli, $data) { 7 | Assert::true(false, 'never here'); 8 | }); 9 | $cli->on("error", function(Swoole\Client $cli) { echo "connect timeout\n"; }); 10 | $cli->on("close", function(Swoole\Client $cli) { echo "close\n"; }); 11 | $cli->connect("11.11.11.11", 9000, 0.5); 12 | -------------------------------------------------------------------------------- /tests/include/api/swoole_http_server/http_server_without_response.php: -------------------------------------------------------------------------------- 1 | on("request", function ($request, $response) { 8 | }); 9 | 10 | $httpServer->start(); 11 | -------------------------------------------------------------------------------- /tests/include/api/swoole_http_server/simple_http_server.php: -------------------------------------------------------------------------------- 1 | start(); -------------------------------------------------------------------------------- /tests/include/api/swoole_server/testsendfile.txt: -------------------------------------------------------------------------------- 1 | testsendfile.txt 2 | -------------------------------------------------------------------------------- /tests/include/api/swoole_thread/putenv.php: -------------------------------------------------------------------------------- 1 | connect(); 10 | 11 | $data = ""; 12 | for ($i = 0; $i < 100; $i++) 13 | { 14 | $client->send($data); 15 | $response = $client->recv(); 16 | Assert::same($response, "SUCCESS", "response failed"); 17 | } 18 | } -------------------------------------------------------------------------------- /tests/include/api/syntax_error.txt: -------------------------------------------------------------------------------- 1 | parentFunc)(); 16 | } else { 17 | ($this->childFunc)(...$args); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/include/ssl_certs/ca.srl: -------------------------------------------------------------------------------- 1 | BC864F1DFA88521C 2 | -------------------------------------------------------------------------------- /tests/include/ssl_certs/client.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCRFJwc1004slJg28oZEKEP8h9c 3 | 057iJOTHoNQadH6dZeJMIos3T22ZJOGJE0/x13UxOvNtgqoaPgsBhFalmcsndgGZ 4 | o/Ozhm+GUQsshc843xMHQk78qmUlAaHNYL0hnRImgOJlxPO2NF3DAQWrDq35ju+p 5 | 7s8mly0+8Q46wfkMOQIDAQAB 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /tests/include/ssl_certs/dhparams.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIIBCAKCAQEApP/KXarP09GXAzdxdCHg8QAbVeGxU2hc0O2zE6900PI7Jd1VDOAm 3 | AZ3UEGfwv7WLxrRUJC31/EbkHH3jjnt28De9r3vNdpt30nYQfYHTNnIodi0j566C 4 | CkIY5J0uby/luU5+cX/NpHwA8YCw7wtvt279mACaE99tmfjY7/enDDoO5R+AUZwk 5 | neRUDszaTLPLotYcJm6LSaUvp+22fKazorGx1OiK1/jN1qL+sSwrYW64C4/n17GW 6 | kGYllrHBU6pgknCFhZdzc6SefMNKbVD79kQnDPXvERtOxOR+kv4rwzfmJ6NB5Ahf 7 | Wmz8RdZO5BhrIYqWVjMYi7VZmHtJkzA5FwIBAg== 8 | -----END DH PARAMETERS----- 9 | -------------------------------------------------------------------------------- /tests/include/ssl_certs/server.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCoOKDcu5YkjVFNU4GUBBCjydc5 3 | zYGws2xCf0JbCoSzMyI4r/sWk72BX31HGcPvjcLAsEFGLHQLJg8EE+MHU6+iQSsG 4 | LikZ8i/5eTf4eFRJjYdjBs9jUqqOukDToiTDmIZrsZnK9PFlz6+h6QPiraUIDbdj 5 | RQdJ0m2/xL8iYEsfOQIDAQAB 6 | -----END PUBLIC KEY----- 7 | -------------------------------------------------------------------------------- /tests/php-cs-fixer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | include/lib/vendor/friendsofphp/php-cs-fixer/php-cs-fixer "$@" 4 | 5 | -------------------------------------------------------------------------------- /tests/swoole_atomic/atomic.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_atomic: add/sub/get/cmpset 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | add(199), 200); 12 | Assert::same($atomic->sub(35), 165); 13 | Assert::same($atomic->get(), 165); 14 | Assert::assert($atomic->cmpset(165, 1)); 15 | Assert::assert(!$atomic->cmpset(1555, 0)); 16 | ?> 17 | --EXPECT-- 18 | -------------------------------------------------------------------------------- /tests/swoole_atomic/dtor_in_child.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_atomic: destruct objects in child processe 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | wait(); 13 | echo "Child OK\n"; 14 | exit(0); 15 | }); 16 | $p->start(); 17 | 18 | usleep(200000); 19 | echo "Master OK\n"; 20 | $atomic->wakeup(1); 21 | $status = Swoole\Process::wait(); 22 | ?> 23 | --EXPECT-- 24 | Master OK 25 | Child OK 26 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/10.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: 10 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | push("data"); 14 | }); 15 | Assert::same($chan->pop(0.001), "data"); 16 | Assert::false($chan->pop(0.001)); 17 | }); 18 | 19 | Swoole\Event::wait(); 20 | ?> 21 | --EXPECT-- 22 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/bug_1947.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: channel by return value 3 | --SKIPIF-- 4 | 6 | --FILE-- 7 | pop(0.001); 12 | Assert::false($ret); 13 | }); 14 | function foo() 15 | { 16 | $chan = new \Swoole\Coroutine\Channel(); 17 | go(function () use ($chan) { 18 | // nothing 19 | }); 20 | return $chan; 21 | } 22 | 23 | ?> 24 | --EXPECT-- 25 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/chan_select_timeout.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: coro channel select timeout 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 24 | --EXPECT-- 25 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/pop_close1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: pop close 1 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | close(); 11 | 12 | go(function () use ($c1) { 13 | $ret = $c1->pop(); 14 | echo "pop ret:".var_export($ret,1)." error:".$c1->errCode."\n"; 15 | }); 16 | ?> 17 | --EXPECTF-- 18 | pop ret:false error:-2 19 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/pop_timeout1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: pop timeout 1 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | pop(1); 13 | echo "pop ret:".var_export($ret,1)." error:".$c1->errCode."\n"; 14 | 15 | }); 16 | ?> 17 | --EXPECTF-- 18 | pop ret:false error:-1 19 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/pop_timeout5.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: pop timeout hanging up 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | pop(); 15 | echo "pop ret:".var_export($ret,1)." error:".$c1->errCode."\n"; 16 | }); 17 | ?> 18 | --EXPECTF-- 19 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/push_close1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: push close 1 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | close(); 11 | 12 | go(function () use ($c1) { 13 | $ret = $c1->push(1); 14 | echo "push ret:".var_export($ret,1)." error:".$c1->errCode."\n"; 15 | }); 16 | ?> 17 | --EXPECTF-- 18 | push ret:false error:-2 19 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/push_timeout3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: push timeout 3 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | push(1, 0.1)); 13 | Assert::assert(!$channel->push(1, 0.1)); 14 | }); 15 | 16 | Swoole\Event::wait(); 17 | echo "DONE\n"; 18 | ?> 19 | --EXPECT-- 20 | DONE 21 | -------------------------------------------------------------------------------- /tests/swoole_channel_coro/push_timeout4.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_channel_coro: push timeout 3 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | push(1, 0.1)); 13 | Assert::assert($channel->push(1, 0.1)); 14 | }); 15 | 16 | go(function () use ($channel) { 17 | Assert::same($channel->pop(0.1), 1); 18 | }); 19 | 20 | Swoole\Event::wait(); 21 | echo "DONE\n"; 22 | ?> 23 | --EXPECT-- 24 | DONE 25 | -------------------------------------------------------------------------------- /tests/swoole_client_async/connect_twice.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_async: connect twice 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 10 | --EXPECT-- 11 | error 12 | -------------------------------------------------------------------------------- /tests/swoole_client_async/enableSSL_bad_callback.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_async: enableSSL with bad callback 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | enableSSL(); 12 | } catch (Exception $e) { 13 | Assert::contains($e->getMessage(), 'require `onSslReady` callback'); 14 | } 15 | ?> 16 | --EXPECTF-- 17 | -------------------------------------------------------------------------------- /tests/swoole_client_coro/close_twice.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_coro: close twice 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect('www.baidu.com', 80); 11 | Assert::true($cli->close()); 12 | Assert::false($cli->close()); 13 | Assert::eq($cli->errCode, SWOOLE_ERROR_CLIENT_NO_CONNECTION); 14 | }); 15 | Swoole\Event::wait(); 16 | ?> 17 | --EXPECT-- 18 | -------------------------------------------------------------------------------- /tests/swoole_client_coro/connect_dns_timeout.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_coro: connect dns timeout 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 0.005]); 10 | 11 | Co\run(function () { 12 | $cli = new Swoole\Coroutine\Client(SWOOLE_SOCK_TCP); 13 | Assert::assert(!@$cli->connect('xxx.66xx.6855.xxx.xx'.rand(1000, 9999) . time(), 80)); 14 | Assert::same($cli->errCode, SWOOLE_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT); 15 | }); 16 | ?> 17 | --EXPECT-- 18 | -------------------------------------------------------------------------------- /tests/swoole_client_coro/connect_with_dns.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_coro: connect with dns 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | connect('www.qq.com', 80)); 14 | }); 15 | 16 | ?> 17 | --EXPECT-- 18 | -------------------------------------------------------------------------------- /tests/swoole_client_coro/export_socket.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_coro: close socket property 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect('www.baidu.com', 80)); 11 | Assert::true($cli->connected); 12 | $socket = $cli->exportSocket(); 13 | $socket->close(); 14 | Assert::false($cli->recv()); 15 | Assert::false($cli->close()); 16 | }); 17 | Swoole\Event::wait(); 18 | ?> 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_client_coro/getsockname.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_coro: getsockname 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect('www.baidu.com', 80); 13 | $info = $conn->getsockname(); 14 | Assert::assert(filter_var($info['host'], FILTER_VALIDATE_IP)); 15 | Assert::greaterThan($info['port'], 0); 16 | } 17 | ); 18 | ?> 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_client_sync/connect_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_sync: connect 1 - 1 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect("11.11.11.11", 80, 0.5); 13 | Assert::false($r); 14 | Assert::eq($cli->errCode, SOCKET_ETIMEDOUT); 15 | ?> 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_client_sync/connect_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_sync: connect 1 - 2 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect(MYSQL_SERVER_HOST, MYSQL_SERVER_PORT); 13 | Assert::assert($r); 14 | $cli->close(); 15 | echo "SUCCESS"; 16 | ?> 17 | --EXPECT-- 18 | SUCCESS 19 | -------------------------------------------------------------------------------- /tests/swoole_client_sync/enableSSL_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_async: enableSSL 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect("www.baidu.com", 443, 2.0)); 11 | 12 | try { 13 | $cli->enableSSL(function (){}); 14 | } catch (\Throwable $e) { 15 | Assert::contains($e->getMessage(), 'not support `onSslReady` callback'); 16 | } 17 | ?> 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_client_sync/http_proxy.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_sync: http client with http_proxy 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | set([ 16 | 'timeout' => 30, 17 | 'http_proxy_host' => HTTP_PROXY_HOST, 18 | 'http_proxy_port' => HTTP_PROXY_PORT 19 | ]); 20 | client_http_v10_get($cli) 21 | ?> 22 | --EXPECT-- 23 | -------------------------------------------------------------------------------- /tests/swoole_client_sync/socks5_proxy.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_client_sync: http client with http_proxy 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | set([ 16 | 'timeout' => 30, 17 | 'socks5_host' => SOCKS5_PROXY_HOST, 18 | 'socks5_port' => SOCKS5_PROXY_PORT 19 | ]); 20 | client_http_v10_get($cli) 21 | ?> 22 | --EXPECT-- 23 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/array_walk.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: array_walk 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 20 | --EXPECTF-- 21 | DONE 22 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/async_callback/signal.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/async_callback: signal 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | int(10) 24 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/bailout/error.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/bailout: error 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 19 | --EXPECTF-- 20 | Fatal error: Uncaught Error in %s:%d 21 | Stack trace: 22 | %A 23 | thrown in %s on line %d 24 | shutdown 25 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/bailout/error_internal.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/bailout: error 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 15 | --EXPECTF-- 16 | Fatal error: Allowed memory size of %d bytes exhausted %s 17 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/bailout/error_internal2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/bailout: error 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 17 | --EXPECTF-- 18 | Fatal error: Allowed memory size of %d bytes exhausted %s 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/bug_5699.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: Github bug #5699 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 15 | --EXPECT-- 16 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/call_user_func_array.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: call_user_func_array 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 21 | --EXPECT-- 22 | foo 23 | bar 24 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/callback.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro callback 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | test; 19 | } 20 | } 21 | 22 | for ($c = MAX_CONCURRENCY; $c--;) { 23 | go([new TestCo, 'foo']); 24 | } 25 | 26 | ?> 27 | --EXPECTF-- 28 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/cid.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: cid increment 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 15 | --EXPECT-- 16 | DONE 17 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/create_after_rshutdown.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: create coroutine after RSHTUDOWN 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECTF-- 19 | DONE 20 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/current.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: current cid 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: swoole_async_dns_lookup_coro 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: async dns lookup timeout 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: async dns lookup [3] 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_4.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: bad dns server 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | '192.0.0.1:10053']); 14 | $host = Swoole\Coroutine::dnsLookup('www.baidu.com', 0.5); 15 | Assert::eq($host, false); 16 | Assert::eq(swoole_last_error(), SWOOLE_ERROR_DNSLOOKUP_RESOLVE_FAILED); 17 | }); 18 | ?> 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_5.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: async dns lookup [5] 3 | --SKIPIF-- 4 | 6 | --FILE-- 7 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_ipv6.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: dns Lookup IPv6 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/dnslookup_query_hosts.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: dnslookup query hosts 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/empty.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro empty 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 14 | --EXPECT-- 15 | co[1] start 16 | co[1] exit 17 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/eval.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: eval 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 23 | --EXPECT-- 24 | start 1 25 | start 2 26 | main end 27 | end 1 28 | end 2 29 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/exception/core_error.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/exception: fatal error 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECTF-- 19 | Parse error: syntax error, unexpected identifier "xde" in %s on line %d 20 | shutdown 21 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/exit.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: exit 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 12 | --EXPECTF-- 13 | NULL 14 | NULL 15 | bool(true) 16 | bool(false) 17 | int(1) 18 | float(1.1) 19 | string(4) "exit" 20 | array(1) { 21 | ["exit"]=> 22 | string(2) "ok" 23 | } 24 | object(stdClass)#%d (%d) { 25 | ["exit"]=> 26 | string(2) "ok" 27 | } 28 | resource(%d) of type (stream) 29 | int(0) 30 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/exit_84.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: exit 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 12 | --EXPECTF-- 13 | int(1) 14 | string(4) "exit" 15 | int(0) 16 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/forbidden_case/array_map.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/forbidden_case: coro array map 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 21 | --EXPECT-- 22 | func start 23 | main end 24 | func end 25 | co end 26 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/getElasped.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: getElapsed 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 17 | --EXPECT-- 18 | int(-1) 19 | int(-1) 20 | bool(true) 21 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/max_num_limit.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: max num limit 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 11 | --EXPECTF-- 12 | %d 13 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/nested1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro channel 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 21 | --EXPECT-- 22 | co[1] start 23 | end 24 | co[2] start 25 | co[1] exit 26 | co[2] exit 27 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/nested2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro nested2 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 21 | --EXPECT-- 22 | co[1] start 23 | co[2] start 24 | end 25 | co[1] exit 26 | co[2] exit 27 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/nested3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro nested3 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 21 | --EXPECT-- 22 | co[1] start 23 | co[2] start 24 | end 25 | co[2] exit 26 | co[1] exit 27 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/nested_empty.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro nested empty 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | co[1] start 20 | co[2] start 21 | co[2] exit 22 | co[1] exit 23 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/new_process.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: new process 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 11 | }); 12 | ?> 13 | --EXPECTF-- 14 | Fatal error: Uncaught Swoole\Error: must be forked outside the coroutine in %s:%d 15 | Stack trace: 16 | #0 %s(5): Swoole\Process->start() 17 | %A 18 | thrown in %s on line %d 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/new_server.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: new server 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | on('receive', function () { 11 | }); 12 | $server->start(); 13 | }); 14 | ?> 15 | --EXPECTF-- 16 | Warning: Swoole\Server::start(): eventLoop has already been created, unable to start %s in %s on line %d 17 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/output/create.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/output: main output global 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 20 | --EXPECT-- 21 | 2 22 | 1 23 | 0 24 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/output/ob_main.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine/output: main output global 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/parallel1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro parallel1 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 23 | --EXPECT-- 24 | co[1] start 25 | co[2] start 26 | end 27 | co[1] exit 28 | co[2] exit 29 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/parallel2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: coro parallel2 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 23 | --EXPECT-- 24 | co[1] start 25 | co[2] start 26 | end 27 | co[2] exit 28 | co[1] exit 29 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/resume_loop.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: resume loop 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 0) { 14 | Co::resume(array_shift($cos)); 15 | } 16 | }); 17 | } 18 | Co::resume(array_shift($cos)); 19 | echo "DONE\n"; 20 | ?> 21 | --EXPECT-- 22 | DONE 23 | -------------------------------------------------------------------------------- /tests/swoole_coroutine/user_coroutine_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine: user coroutine 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 14 | --EXPECT-- 15 | OK 16 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_scheduler/getOptions.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_scheduler: getOptions 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | set(['max_coroutine' => 100, 'deadlock_check_max_stack' => 64, ]); 11 | $options = $sch->getOptions(); 12 | ASsert::isArray($options); 13 | Assert::eq($options['deadlock_check_max_stack'], 64); 14 | ?> 15 | --EXPECT-- 16 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_system/getaddrinfo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_system: getaddrinfo 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 19 | --EXPECT-- 20 | DONE 21 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_system/gethostbyname.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_system: gethostbyname 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 17 | --EXPECT-- 18 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_system/gethostbyname_ipv6.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_system: gethostbyname for IPv6 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_system/readfile.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_system: readFile 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 14 | --EXPECT-- 15 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_system/sleep.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_system: sleep 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 15 | --EXPECT-- 16 | OK 17 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_util/exec.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_util: exec 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_util/exec_sleep.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_util: coroutine exec 3 | --SKIPIF-- 4 | 6 | --FILE-- 7 | 20 | --EXPECT-- 21 | DONE 22 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_util/fread.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_util: fread 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_coroutine_wait_group/empty.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_coroutine_wait_group: empty 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | add(1); 10 | $wg->add(-1); 11 | $wg->wait(); 12 | $wg->add(1); 13 | $wg->done(); 14 | $wg->wait(); 15 | echo "DONE\n"; 16 | ?> 17 | --EXPECT-- 18 | DONE 19 | -------------------------------------------------------------------------------- /tests/swoole_curl/multi/no_hook.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_curl/multi: no hook 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 18 | --EXPECT-- 19 | Done 20 | -------------------------------------------------------------------------------- /tests/swoole_curl/multi_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_curl: multi 1 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 22 | --EXPECT-- 23 | Done 24 | -------------------------------------------------------------------------------- /tests/swoole_curl/multi_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_curl: multi 2 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 0.2]); 19 | echo "Done\n"; 20 | }); 21 | ?> 22 | --EXPECT-- 23 | Done 24 | -------------------------------------------------------------------------------- /tests/swoole_curl/template: -------------------------------------------------------------------------------- 1 | require __DIR__ . '/../../include/bootstrap.php'; 2 | 3 | $cm = new \SwooleTest\CurlManager(); 4 | $cm->run(function ($host) { 5 | 6 | 7 | }); -------------------------------------------------------------------------------- /tests/swoole_curl/upload/curl_testdata1.txt: -------------------------------------------------------------------------------- 1 | CURL1 2 | -------------------------------------------------------------------------------- /tests/swoole_curl/upload/curl_testdata2.txt: -------------------------------------------------------------------------------- 1 | CURL2 2 | -------------------------------------------------------------------------------- /tests/swoole_event/defer_without_io.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_event: Swoole\Event::defer without io 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 15 | --EXPECT-- 16 | defer [1] 17 | -------------------------------------------------------------------------------- /tests/swoole_event/deprecated_event_wait.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_event: deprecated_event_wait 3 | --SKIPIF-- 4 | 11 | --FILE-- 12 | 22 | --EXPECT-- 23 | -------------------------------------------------------------------------------- /tests/swoole_event/dispatch.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_event: dispatch 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | loop 24 | loop 25 | Tick 26 | loop 27 | Tick 28 | loop 29 | Tick 30 | loop 31 | Tick 32 | -------------------------------------------------------------------------------- /tests/swoole_event/simple.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_event: Swoole\Event::exit 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 7 | 16 | --EXPECT-- 17 | tick 18 | -------------------------------------------------------------------------------- /tests/swoole_function/swoole_clear_dns_cache.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_function: test swoole_clear_dns_cache 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 11 | --EXPECT-- 12 | -------------------------------------------------------------------------------- /tests/swoole_function/swoole_cpu_num.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_function: swoole_cpu_num 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 13 | --EXPECTF-- 14 | cpu_num: %d 15 | -------------------------------------------------------------------------------- /tests/swoole_function/swoole_get_local_ip.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_function: get local ip 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_function/swoole_get_local_mac.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_function: get mac address 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_function/swoole_set_process_name.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_function: set process name 3 | --SKIPIF-- 4 | 9 | --FILE-- 10 | 20 | --EXPECT-- 21 | SUCCESS 22 | -------------------------------------------------------------------------------- /tests/swoole_function/swoole_version.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_function: swoole_version 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 13 | --EXPECTF-- 14 | swoole_version: %s 15 | -------------------------------------------------------------------------------- /tests/swoole_global/closed_stdout.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_global: handle closed STDOUT/STDERR without exception 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 9 | --EXPECT-- 10 | -------------------------------------------------------------------------------- /tests/swoole_global/function_alias.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_global: function alias 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 12 | --EXPECTF-- 13 | bool(true) 14 | -------------------------------------------------------------------------------- /tests/swoole_global/too_many_objects.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_global: too many objects 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | listen('127.0.0.1', get_one_free_port(), SWOOLE_TCP); 14 | echo "DONE\n"; 15 | ?> 16 | --EXPECT-- 17 | DONE 18 | -------------------------------------------------------------------------------- /tests/swoole_global/unset_property_01.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_global: unset internal class property 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | capacity); 10 | ?> 11 | --EXPECTF-- 12 | Fatal error: Uncaught Error: Property capacity of class Swoole\Coroutine\Channel cannot be unset in %s/tests/%s/unset%s.php:%d 13 | Stack trace: 14 | #0 {main} 15 | thrown in %s 16 | -------------------------------------------------------------------------------- /tests/swoole_global/unset_property_02.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_global: unset user class's parent internal property 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | capacity); 14 | ?> 15 | --EXPECTF-- 16 | Fatal error: Uncaught Error: Property capacity of class %s cannot be unset in %s:%d 17 | Stack trace: 18 | #0 {main} 19 | thrown in %s 20 | -------------------------------------------------------------------------------- /tests/swoole_global/unset_property_03.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_global: unset user class's own property 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | t); 14 | ?> 15 | --EXPECTF-- 16 | -------------------------------------------------------------------------------- /tests/swoole_http2_client_coro/bug_5127.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_http2_client_coro: Github #5127 When use swoole in php 8.2,Swoole\Http2\Request may throw ErrorException:Creation of dynamic property $usePipelineRead 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | usePipelineRead = true; 11 | echo 'DONE'; 12 | ?> 13 | --EXPECT-- 14 | DONE 15 | -------------------------------------------------------------------------------- /tests/swoole_http_server_coro/random_port.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_http_server_coro: bind random port 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | port > 0 and $server->port < 65535); 12 | }); 13 | 14 | ?> 15 | --EXPECT-- 16 | -------------------------------------------------------------------------------- /tests/swoole_library/database/mysqli.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_library/database: pdo 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 13 | --EXPECTF-- 14 | Use %fs for %d queries 15 | -------------------------------------------------------------------------------- /tests/swoole_library/database/pdo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_library/database: pdo 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 13 | --EXPECTF-- 14 | Use %fs for %d queries 15 | -------------------------------------------------------------------------------- /tests/swoole_library/database/redis.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_library/database: pdo 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 13 | --EXPECTF-- 14 | Use %fs for %d queries 15 | -------------------------------------------------------------------------------- /tests/swoole_library/exec/exec/1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_library/exec/exec: Test exec 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_library/exec/shell_exec/1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_library/exec/shell_exec: shell_exec 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 19 | --EXPECT-- 20 | -------------------------------------------------------------------------------- /tests/swoole_lock/lockwait_twice.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_lock: test lock twice 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | lock()); 11 | 12 | 13 | $start = microtime(true); 14 | $ret = $lock->lockwait(0.2); 15 | Assert::false($ret); 16 | $end = microtime(true); 17 | 18 | Assert::eq($lock->errCode, SOCKET_ETIMEDOUT); 19 | Assert::lessThan($end - $start, 0.2); 20 | 21 | ?> 22 | --EXPECT-- 23 | bool(true) 24 | -------------------------------------------------------------------------------- /tests/swoole_pdo_odbc/server_info.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_pdo_odbc: test hook pgsql 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | getAttribute(PDO::ATTR_SERVER_INFO); 14 | Assert::eq(strtolower($info), 'mysql'); 15 | }); 16 | 17 | echo "Done\n"; 18 | ?> 19 | --EXPECTF-- 20 | Done 21 | -------------------------------------------------------------------------------- /tests/swoole_pdo_oracle/pdo_oracle.inc: -------------------------------------------------------------------------------- 1 | getMessage()); 11 | } 12 | } 13 | 14 | public static function create(): PDO 15 | { 16 | $db = new PDO(ORACLE_TNS, ORACLE_USER, ORACLE_PASSWORD); 17 | $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); 18 | return $db; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/swoole_pdo_sqlite/pdo_sqlite.inc: -------------------------------------------------------------------------------- 1 | getMessage()); 11 | } 12 | } 13 | 14 | public static function create(): PDO 15 | { 16 | return new PDO(SQLITE_DSN); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/swoole_process/coro/start.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process/coro: start with coroutine 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 15 | Assert::assert($r > 0); 16 | $proc->close(); 17 | 18 | \Swoole\Process::wait(true); 19 | 20 | ?> 21 | --EXPECT-- 22 | SUCCESS 23 | -------------------------------------------------------------------------------- /tests/swoole_process/ctor.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: ctor 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 16 | --EXPECT-- 17 | SUCCESS 18 | -------------------------------------------------------------------------------- /tests/swoole_process/echo.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def main(): 4 | s = raw_input() 5 | print "Python: " + s 6 | 7 | main() 8 | -------------------------------------------------------------------------------- /tests/swoole_process/exec.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: exec 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | exec("/usr/bin/printf", ["HELLO"]); 11 | }, true); 12 | $proc->start(); 13 | echo $proc->read(); 14 | $proc->exec("/usr/bin/printf", [" WORLD"]); 15 | 16 | \Swoole\Process::wait(true); 17 | ?> 18 | --EXPECT-- 19 | HELLO WORLD 20 | -------------------------------------------------------------------------------- /tests/swoole_process/exit.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: exit 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | exit(9); 11 | }); 12 | $pid = $proc->start(); 13 | 14 | $i = \Swoole\Process::wait(true); 15 | Assert::same($i["code"], 9); 16 | 17 | echo "SUCCESS"; 18 | ?> 19 | --EXPECT-- 20 | SUCCESS 21 | -------------------------------------------------------------------------------- /tests/swoole_process/freeQueue.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: freeQueue 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | useQueue(); 11 | Assert::assert($r); 12 | 13 | $proc->start(); 14 | $r = $proc->freeQueue(); 15 | Assert::assert($r); 16 | 17 | \Swoole\Process::wait(); 18 | 19 | ?> 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_process/getaffinity.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: getAffinity 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_process/kill.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: kill 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 13 | Swoole\Process::kill($pid, SIGKILL); 14 | $i = \Swoole\Process::wait(true); 15 | Assert::same($i["signal"], SIGKILL); 16 | echo "SUCCESS"; 17 | ?> 18 | --EXPECT-- 19 | SUCCESS 20 | -------------------------------------------------------------------------------- /tests/swoole_process/null_callback.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: null callback 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 14 | 15 | ?> 16 | --EXPECTF-- 17 | Warning: Swoole\Process::start(): illegal callback function in %s 18 | -------------------------------------------------------------------------------- /tests/swoole_process/pop.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: pop 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | useQueue(); 12 | $proc->push("SUCCESS"); 13 | echo $proc->pop(); 14 | $proc->freeQueue(); 15 | ?> 16 | --EXPECT-- 17 | SUCCESS 18 | -------------------------------------------------------------------------------- /tests/swoole_process/process_push.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: push 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | pop(); 14 | 15 | echo "$recv"; 16 | usleep(20000); 17 | 18 | $worker->exit(0); 19 | }, false, false); 20 | 21 | $process->useQueue(); 22 | $pid = $process->start(); 23 | 24 | $process->push("hello worker\n"); 25 | Process::wait(); 26 | ?> 27 | --EXPECT-- 28 | hello worker 29 | -------------------------------------------------------------------------------- /tests/swoole_process/read.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: read 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | write("SUCCESS"); 11 | Assert::same($r, 7); 12 | }); 13 | $r = $proc->start(); 14 | Assert::assert($r > 0); 15 | 16 | Swoole\Timer::after(10, function() use($proc) { 17 | echo $proc->read(); 18 | // Swoole\Event::exit(); 19 | }); 20 | 21 | \Swoole\Process::wait(true); 22 | ?> 23 | --EXPECT-- 24 | SUCCESS 25 | -------------------------------------------------------------------------------- /tests/swoole_process/redirect.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: redirect 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 14 | $r = $proc->read(); 15 | echo "READ: $r~"; 16 | 17 | \Swoole\Process::wait(true); 18 | ?> 19 | --EXPECT-- 20 | READ: SUCCESS~ 21 | -------------------------------------------------------------------------------- /tests/swoole_process/setaffinity.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: setAffinity 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 1) { 14 | $r = Swoole\Process::setaffinity([0, 1]); 15 | Assert::assert($r); 16 | } 17 | echo "SUCCESS"; 18 | ?> 19 | --EXPECT-- 20 | SUCCESS 21 | -------------------------------------------------------------------------------- /tests/swoole_process/start.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: start 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 13 | Assert::assert($r > 0); 14 | $proc->close(); 15 | 16 | \Swoole\Process::wait(true); 17 | ?> 18 | --EXPECT-- 19 | SUCCESS 20 | -------------------------------------------------------------------------------- /tests/swoole_process/timeout.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: pipe read timeout 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | start(); 13 | Assert::assert($r > 0); 14 | ini_set("swoole.display_errors", "off"); 15 | $proc->setTimeout(0.5); 16 | $ret = $proc->read(); 17 | Assert::false($ret); 18 | Swoole\Process::kill($proc->pid, SIGKILL); 19 | \Swoole\Process::wait(true); 20 | ?> 21 | --EXPECT-- 22 | -------------------------------------------------------------------------------- /tests/swoole_process/useQueue.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: useQueue 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | pop(); 11 | }); 12 | $proc->useQueue(); 13 | $proc->start(); 14 | $proc->push("SUCCESS"); 15 | 16 | \Swoole\Process::wait(true); 17 | $proc->freeQueue(); 18 | ?> 19 | --EXPECT-- 20 | SUCCESS 21 | -------------------------------------------------------------------------------- /tests/swoole_process/write.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process: write 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | write("SUCCESS"); 11 | Assert::same($r, 7); 12 | }); 13 | $r = $proc->start(); 14 | Assert::assert($r > 0); 15 | 16 | Swoole\Timer::after(10, function() use($proc) { 17 | echo $proc->read(); 18 | }); 19 | 20 | \Swoole\Process::wait(true); 21 | ?> 22 | --EXPECT-- 23 | SUCCESS 24 | -------------------------------------------------------------------------------- /tests/swoole_process_pool/master_pid.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process_pool: master pid 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | on('workerStart', function (Swoole\Process\Pool $pool, int $workerId) use ($pid) 14 | { 15 | Assert::assert($pool->master_pid == $pid); 16 | posix_kill($pid, SIGTERM); 17 | sleep(20); 18 | echo "ERROR\n"; 19 | }); 20 | 21 | $pool->start(); 22 | ?> 23 | --EXPECT-- 24 | -------------------------------------------------------------------------------- /tests/swoole_process_pool/shutdown.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_process_pool: shutdown 3 | --SKIPIF-- 4 | 6 | --FILE-- 7 | on('workerStart', function (Swoole\Process\Pool $pool, int $workerId) 12 | { 13 | $pool->shutdown(); 14 | sleep(20); 15 | echo "ERROR\n"; 16 | }); 17 | 18 | $pool->start(); 19 | ?> 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_redis_server/getHandler.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_redis_server: getHandler 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | setHandler('GET', function ($fd, $data) use ($server) { 13 | $server->send($fd, Server::format(Server::STRING, "hello")); 14 | }); 15 | 16 | $callback = $server->getHandler('GET'); 17 | Assert::assert(is_callable($callback)); 18 | 19 | ?> 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_runtime/file_hook/a.inc: -------------------------------------------------------------------------------- 1 | 7 | --FILE-- 8 | 19 | --EXPECT-- 20 | A 21 | B 22 | -------------------------------------------------------------------------------- /tests/swoole_runtime/file_lock/lock_nb.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime/file_lock: lock_nb 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 19 | --EXPECTF-- 20 | -------------------------------------------------------------------------------- /tests/swoole_runtime/get_hook_flags.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: get hook flags 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 14 | --EXPECT-- 15 | -------------------------------------------------------------------------------- /tests/swoole_runtime/gethostbyname.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: sleep 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 18 | --EXPECTF-- 19 | -------------------------------------------------------------------------------- /tests/swoole_runtime/hook_default.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: enable hook by default 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_runtime/hook_enable_coroutine.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: enableCoroutine 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 22 | --EXPECT-- 23 | -------------------------------------------------------------------------------- /tests/swoole_runtime/hook_set_flags.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: set hook flags 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 0]); 12 | 13 | Co\run(function () { 14 | Assert::eq(Swoole\Runtime::getHookFlags(), 0); 15 | }); 16 | 17 | Co::set(['hook_flags' => SWOOLE_HOOK_CURL]); 18 | 19 | Co\run(function () { 20 | Assert::eq(Swoole\Runtime::getHookFlags(), SWOOLE_HOOK_CURL); 21 | }); 22 | 23 | ?> 24 | --EXPECT-- 25 | -------------------------------------------------------------------------------- /tests/swoole_runtime/library.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: library 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | bool(true) 20 | -------------------------------------------------------------------------------- /tests/swoole_runtime/out_of_coroutine.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: out of coroutine 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_runtime/proc/proc_open_pipes.inc: -------------------------------------------------------------------------------- 1 | 5 | --FILE-- 6 | 17 | --EXPECTF-- 18 | bool(false) 19 | -------------------------------------------------------------------------------- /tests/swoole_runtime/stream_context_pass_null.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime: stream context pass null 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | bool(true) 20 | -------------------------------------------------------------------------------- /tests/swoole_runtime/unsafe/pcntl_fork.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_runtime/unsafe: pcntl_fork 3 | --SKIPIF-- 4 | 7 | --FILE-- 8 | 17 | --EXPECTF-- 18 | Warning: pcntl_fork() has been disabled for security reasons in %s on line %d 19 | -------------------------------------------------------------------------------- /tests/swoole_server/bug_2313.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_server: bug Github#2313 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | childFunc = function () use ($pm) { 10 | $server = new Swoole\Server('127.0.0.1', 9501, SWOOLE_PROCESS); 11 | $process = new Swoole\Process(function () { }); 12 | $server->addProcess($process); 13 | var_dump($process->id); 14 | $pm->wakeup(); 15 | }; 16 | $pm->childFirst(); 17 | $pm->run(); 18 | ?> 19 | --EXPECTF-- 20 | int(%d) 21 | -------------------------------------------------------------------------------- /tests/swoole_server/listen_fail.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_server: listen fail 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | SWOOLE_LOG_NONE]); 9 | try { 10 | $serv = new Swoole\Server('192.0.0.1', 80, SWOOLE_PROCESS); 11 | } catch (Swoole\Exception $e) { 12 | Assert::same($e->getCode(), SOCKET_EADDRNOTAVAIL); 13 | echo "DONE\n"; 14 | } 15 | ?> 16 | --EXPECT-- 17 | DONE 18 | -------------------------------------------------------------------------------- /tests/swoole_server/ssl/code/client.js: -------------------------------------------------------------------------------- 1 | const tls = require('tls'); 2 | 3 | const options = { 4 | rejectUnauthorized: false, 5 | }; 6 | 7 | var socket = tls.connect(process.argv[2], '127.0.0.1', options, () => { 8 | socket.write('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n'); 9 | }); 10 | 11 | socket.setEncoding('utf8'); 12 | socket.on('data', (data) => { 13 | console.log(data); 14 | }); 15 | 16 | socket.on('end', () => { 17 | console.log('Ended') 18 | }); -------------------------------------------------------------------------------- /tests/swoole_server_coro/random_port.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_server_coro: bind random port 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | port > 0 and $server->port < 65535); 12 | }); 13 | 14 | ?> 15 | --EXPECT-- 16 | -------------------------------------------------------------------------------- /tests/swoole_socket_coro/fd.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_socket_coro: fd 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 1) { 12 | Assert::assert(end($sockets)->fd === prev($sockets)->fd + 1); 13 | } 14 | } 15 | echo "DONE\n"; 16 | ?> 17 | --EXPECT-- 18 | DONE 19 | -------------------------------------------------------------------------------- /tests/swoole_socket_coro/getsockname.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_socket_coro: getsockname 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | bind('127.0.0.1'); 10 | $info = $conn->getsockname(); 11 | Assert::same($info['address'] ?? '', '127.0.0.1'); 12 | Assert::greaterThan($info['port'], 0); 13 | ?> 14 | --EXPECT-- 15 | -------------------------------------------------------------------------------- /tests/swoole_socket_coro/setopt/ipv6_pktinfo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_socket_coro/setopt: setOption IPV6_PKTINFO 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | setOption(IPPROTO_IPV6, IPV6_PKTINFO, [])); 12 | var_dump($socket->setOption(IPPROTO_IPV6, IPV6_PKTINFO, [ 13 | "addr" => '::1', 14 | "ifindex" => 0 15 | ])); 16 | 17 | ?> 18 | --EXPECTF-- 19 | bool(false) 20 | bool(true) 21 | -------------------------------------------------------------------------------- /tests/swoole_socket_coro/setopt/reuse.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_socket_coro/setopt: setOption SO_RCVTIMEO 3 | --DESCRIPTION-- 4 | -wrong params 5 | -set/get params comparison 6 | --SKIPIF-- 7 | 8 | --FILE-- 9 | bind("127.0.0.1", 9501); 14 | 15 | Assert::assert($socket->setOption(SOL_SOCKET, SO_REUSEADDR, true)); 16 | Assert::assert($socket->setOption(SOL_SOCKET, SO_REUSEPORT, true)); 17 | 18 | ?> 19 | --EXPECTF-- 20 | -------------------------------------------------------------------------------- /tests/swoole_socket_coro/ssl.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_socket_coro: ssl client 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_table/bug_2263.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_table: bug_2263 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | column('data', Table::TYPE_STRING, 1); 13 | $table->create(); 14 | 15 | $table->set("1234567890", ['data' => '1']); 16 | $table->set("44984", ['data' => '2']); 17 | 18 | $table->del("1234567890"); 19 | 20 | foreach($table as $ip => $row) { 21 | echo $ip."\n"; 22 | } 23 | 24 | ?> 25 | --EXPECT-- 26 | 44984 27 | -------------------------------------------------------------------------------- /tests/swoole_table/create_10k_object.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_table: create 10,000 objects 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 13 | --EXPECT-- 14 | DONE 15 | -------------------------------------------------------------------------------- /tests/swoole_table/getMemorySize_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_table: getMemorySize 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | getMemorySize(), 0); 13 | $table->column('name', Table::TYPE_STRING, 32); 14 | $table->create(); 15 | Assert::greaterThan($table->getMemorySize(), 0); 16 | ?> 17 | --EXPECTF-- 18 | -------------------------------------------------------------------------------- /tests/swoole_thread/empty_args.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_thread: info 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 17 | --EXPECTF-- 18 | -------------------------------------------------------------------------------- /tests/swoole_thread/fatal_error_1.inc: -------------------------------------------------------------------------------- 1 | join(); 10 | echo "stop child thread\n"; 11 | } else { 12 | Co\run(function () { 13 | (function () { 14 | swoole_implicit_fn('fatal_error'); 15 | })(); 16 | }); 17 | } 18 | echo "DONE\n"; 19 | -------------------------------------------------------------------------------- /tests/swoole_thread/fatal_error_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_thread: fatal error 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | getChildOutput(); 16 | Assert::contains($output, "start child thread\n"); 17 | Assert::contains($output, "stop child thread\n"); 18 | Assert::contains($output, "Fatal error: Uncaught Swoole\Error: test"); 19 | ?> 20 | --EXPECT-- 21 | -------------------------------------------------------------------------------- /tests/swoole_thread/fatal_error_2.inc: -------------------------------------------------------------------------------- 1 | join(); 10 | echo "stop child thread\n"; 11 | } else { 12 | (function () { 13 | swoole_implicit_fn('fatal_error'); 14 | })(); 15 | } 16 | echo "DONE\n"; 17 | -------------------------------------------------------------------------------- /tests/swoole_thread/map2array.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_thread: map to array 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | 1111]); 18 | $ls = $LURDATE[$time]->toArray(); 19 | foreach ($ls as $k => $v) { 20 | unset($LURDATE[$time][$k]); 21 | } 22 | unset($LURDATE[$time]); 23 | ?> 24 | --EXPECTF-- 25 | -------------------------------------------------------------------------------- /tests/swoole_thread/server/functions.inc: -------------------------------------------------------------------------------- 1 | set([ 6 | 'open_eof_check' => true, 7 | 'package_eof' => "\r\n", 8 | ]); 9 | Assert::assert($cli->connect('127.0.0.1', $port, 2)); 10 | $cli->send(json_encode(['type' => 'eof']) . "\r\n"); 11 | Assert::eq($cli->recv(), "EOF\r\n"); 12 | } 13 | -------------------------------------------------------------------------------- /tests/swoole_thread/yield.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_thread: thread status 3 | --SKIPIF-- 4 | 8 | --FILE-- 9 | isAlive()); 16 | $t1->detach(); 17 | Thread::yield(); 18 | usleep(10); 19 | Assert::true($t1->isAlive()); 20 | while (Thread::activeCount() > 1) { 21 | usleep(10); 22 | } 23 | Assert::false($t1->isAlive()); 24 | ?> 25 | --EXPECT-- 26 | -------------------------------------------------------------------------------- /tests/swoole_timer/bug_4794_5.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: #4794 Timer::add() (ERRNO 505): msec value[0] is invalid 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /tests/swoole_timer/bug_4794_7.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: #4794 Timer::add() (ERRNO 505): msec value[0] is invalid 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | connect("11.11.11.11", 80, 0.0005); 13 | Assert::false($r); 14 | Assert::eq($cli->errCode, SOCKET_ETIMEDOUT); 15 | ?> 16 | --EXPECT-- 17 | -------------------------------------------------------------------------------- /tests/swoole_timer/enable_coroutine.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: enable_coroutine setting 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | false 10 | ]); 11 | Swoole\Timer::after(1, function () { 12 | $uid = Co::getuid(); 13 | echo "#{$uid}\n"; 14 | }); 15 | ?> 16 | --EXPECT-- 17 | #-1 18 | -------------------------------------------------------------------------------- /tests/swoole_timer/greater_than_0.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: Timer must be greater than 0 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 14 | --EXPECTF-- 15 | -------------------------------------------------------------------------------- /tests/swoole_timer/next_round.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: timer round control 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 22 | --EXPECT-- 23 | -------------------------------------------------------------------------------- /tests/swoole_timer/not_exist.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: clear timer not exist 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 17 | --EXPECT-- 18 | DONE 19 | -------------------------------------------------------------------------------- /tests/swoole_timer/swoole_timer_list_alias.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: function alias about swoole_timer_list 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 10 | --EXPECT-- 11 | 3 12 | -------------------------------------------------------------------------------- /tests/swoole_timer/verify.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | swoole_timer: verify timer 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 19 | --EXPECT-- 20 | DONE 21 | -------------------------------------------------------------------------------- /tests/template: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | {{test_name}}: {{test_intro}} 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | parentFunc = function () use ($pm) { 10 | 11 | }; 12 | $pm->childFunc = function () use ($pm) { 13 | 14 | }; 15 | $pm->childFirst(); 16 | $pm->run(); 17 | ?> 18 | --EXPECT-- 19 | -------------------------------------------------------------------------------- /thirdparty/boost/asm/jump_combined_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__x86_64__) 11 | #include "jump_x86_64_sysv_macho_gas.S" 12 | #elif defined(__ppc64__) 13 | #include "jump_ppc64_sysv_macho_gas.S" 14 | #elif defined(__arm64__) 15 | #include "jump_arm64_aapcs_macho_gas.S" 16 | #else 17 | #error "No arch's" 18 | #endif 19 | -------------------------------------------------------------------------------- /thirdparty/boost/asm/make_combined_sysv_macho_gas.S: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Sergue E. Leontiev 2013. 3 | Distributed under the Boost Software License, Version 1.0. 4 | (See accompanying file LICENSE_1_0.txt or copy at 5 | http://www.boost.org/LICENSE_1_0.txt) 6 | */ 7 | 8 | // Stub file for universal binary 9 | 10 | #if defined(__x86_64__) 11 | #include "make_x86_64_sysv_macho_gas.S" 12 | #elif defined(__ppc64__) 13 | #include "make_ppc64_sysv_macho_gas.S" 14 | #elif defined(__arm64__) 15 | #include "make_arm64_aapcs_macho_gas.S" 16 | #else 17 | #error "No arch's" 18 | #endif 19 | -------------------------------------------------------------------------------- /thirdparty/hiredis/fmacros.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_FMACRO_H 2 | #define __HIREDIS_FMACRO_H 3 | 4 | #define _XOPEN_SOURCE 600 5 | #define _POSIX_C_SOURCE 200112L 6 | 7 | #if defined(__APPLE__) && defined(__MACH__) 8 | /* Enable TCP_KEEPALIVE */ 9 | #define _DARWIN_C_SOURCE 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /thirdparty/nghttp2/LICENSE: -------------------------------------------------------------------------------- 1 | See COPYING 2 | -------------------------------------------------------------------------------- /thirdparty/nlohmann/detail/macro_unscope.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // restore GCC/clang diagnostic settings 4 | #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) 5 | #pragma GCC diagnostic pop 6 | #endif 7 | #if defined(__clang__) 8 | #pragma GCC diagnostic pop 9 | #endif 10 | 11 | // clean up 12 | #undef JSON_INTERNAL_CATCH 13 | #undef JSON_CATCH 14 | #undef JSON_THROW 15 | #undef JSON_TRY 16 | #undef JSON_HAS_CPP_14 17 | #undef JSON_HAS_CPP_17 18 | #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION 19 | #undef NLOHMANN_BASIC_JSON_TPL 20 | 21 | #include 22 | -------------------------------------------------------------------------------- /thirdparty/nlohmann/detail/meta/void_t.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace nlohmann 4 | { 5 | namespace detail 6 | { 7 | template struct make_void 8 | { 9 | using type = void; 10 | }; 11 | template using void_t = typename make_void::type; 12 | } // namespace detail 13 | } // namespace nlohmann 14 | -------------------------------------------------------------------------------- /tools/build-library.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 |