🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 4.3.0 \[大版本\] [TOC] ## 新增 * 新增`Co::getContext`获取协程上下文对象 ([RFC-1018](https://github.com/swoole/rfc-chinese/issues/45)) ([@twose](https://github.com/twose)) * 新增`Co::getPcid`获取父协程ID ([RFC-1017](https://github.com/swoole/rfc-chinese/issues/41)) ([@twose](https://github.com/twose)) * 新增`Co::exists`判断协程是否存在 ([@twose](https://github.com/twose)) * 协程Hook支持`stream_select`([#2358](https://github.com/swoole/swoole-src/pull/2358)) (matyhtf) * BASE模式下增加`max_wait_time`配置支持 ([#2282](https://github.com/swoole/swoole-src/pull/2282)) ([@shiguangqi](https://github.com/shiguangqi)) * 支持在Master/Manager/User进程中单向投递任务 ([RFC-1015](https://github.com/swoole/rfc-chinese/issues/38)) ([@matyhtf](https://github.com/matyhtf)) * `Co\Socket`模块新增`recvAll`和`sendAll`两个API, 用于确保完整收/发数据, 直到完成或产生错误 ([`3700cbb`](https://github.com/swoole/swoole-src/commit/3700cbb4a5605ec9da74408d4303340852e663cf))([@twose](https://github.com/twose)) * Process支持协程模式, 具体请参考 ([Process中使用协程](https://wiki.swoole.com/wiki/page/p-process_coro.html)) * 新增`Server->getCallback`方法获取Server指定名称的回调函数 ([@matyhtf](https://github.com/matyhtf)) ## 增强 * 现在默认的最大连接数是100K (而不是10K), 如果系统配置小于此数量时取系统配置 ([`3d2e387`](https://github.com/swoole/swoole-src/commit/3d2e3871940ec9eebb109284e4b0cec209fd35f7)) ([@twose](https://github.com/twose)) * 优化Timer定时器的底层代码, 现在它的运行速度更快, 并且支持任意数量的传参 ([#2347](https://github.com/swoole/swoole-src/pull/2347)) ([@twose](https://github.com/twose)) * `Co::stats`将展示更多信息如事件数量, 监听信号数量, aio任务数量等 ([@matyhtf](https://github.com/matyhtf)) * `Co::getBackTrace`在不传参时等同于获取当前调用栈即`debug_backtrace`, 便于代码统一书写 ([@twose](https://github.com/twose)) * `Co::listCoroutines`重命名为`Co::list`, 但仍保留原名作为别名(向下兼容) ([@twose](https://github.com/twose)) * `Table::exist`,`Server::exist`皆重命名为`exists`, 但仍保留原名作为别名(向下兼容) ([@twose](https://github.com/twose)) * Redis自动重连时将会自动鉴权和选择对应的数据库, 新增API:`getOptions`,`getAuth`,`getDBNum`([#2303](https://github.com/swoole/swoole-src/pull/2303)) ([`fdac8a3`](https://github.com/swoole/swoole-src/commit/fdac8a35c4bb48850c64f00dc60440bb679f096a)) ([@windrunner414](https://github.com/windrunner414)&[@twose](https://github.com/twose)) * FreeBSD下默认Socket缓冲区应为2M ([`750a29c`](https://github.com/swoole/swoole-src/commit/750a29cec6e92977dfc6ef7e80c8b5397f6af512)) ([@twose](https://github.com/twose)) * `Server->stats`返回值新增`worker_dispatch_count`来得到master向当前进程投递请求数量, 可通过`worker_dispatch_count - worker_request_count`来获得排队中的请求数量 ([`a353808`](https://github.com/swoole/swoole-src/commit/a353808ed4cd0dda2d746ba114a1bf1d3ac8043c)) ([@matyhtf](https://github.com/matyhtf)) * 移除Nghttp2依赖, 可无需安装, 直接编译选项开启 * 协程现在没有最大嵌套层数限制, 可无限嵌套(协程之间并没有实质的嵌套关系) ([`5458cbc`](https://github.com/swoole/swoole-src/commit/5458cbcf4fd401db442d7580072d06f5489cec79)) ([@twose](https://github.com/twose)) * 协程达到上限时, http服务器将会返回503错误表示服务暂时不可用 ([`ebd377f`](https://github.com/swoole/swoole-src/commit/ebd377f629aa7dca44ee421862d032b6514d6c74)) ([@twose](https://github.com/twose)) * `defer`现在会接收一个参数, 其值为协程结束时的返回值 ([example](https://github.com/swoole/swoole-src/commit/ef978b3b432615b0f392958145d999f4e66584eb)) ([@twose](https://github.com/twose)) ## 修复 * 修复task方法传递null参数时出错的问题 ([#2366](https://github.com/swoole/swoole-src/issues/2366)) ([@twose](https://github.com/twose)) * 修复Http客户端发送大数据时发送不完整的问题 ([#2360](https://github.com/swoole/swoole-src/issues/2360)) ([@twose](https://github.com/twose)) * 修复TCP客户端使用eof协议时, 缓冲区中未处理的数据丢失的问题 ([`a59ae39`](https://github.com/swoole/swoole-src/commit/a59ae394aadfeed77a364d2803e898b6bad39879)) ([@twose](https://github.com/twose)) * 修复Server Reload的异步安全性 ([`022f859`](https://github.com/swoole/swoole-src/commit/022f85920110c6eb94454d6112176b40ae6c9628)) ([@matyhtf](https://github.com/matyhtf)) * 修复连接迭代器的索引值 ([`b066146`](https://github.com/swoole/swoole-src/commit/b066146c4e01e84df5414dc917898dfd55554acd)) ([@twose](https://github.com/twose)) * 修复Set-Cookie时, 特殊字符过长被截断 ([#2368](https://github.com/swoole/swoole-src/issues/2368)) ([@mabu233](https://github.com/mabu233)&[@twose](https://github.com/twose)) * 修复Http客户端没有解码cookie的问题(发送时重复编码) ([`069ca5d`](https://github.com/swoole/swoole-src/commit/069ca5df5736485f2e7e78e7559a4569d15c08ad)) ([@twose](https://github.com/twose)) * 修复Http客户端下载时使用超时功能导致coredump ([#2377](https://github.com/swoole/swoole-src/issues/2377)) ([@matyhtf](https://github.com/matyhtf)&[@twose](https://github.com/twose)) * 修复`__call`+`call_user_func*`调用MySQL客户端方法时产生的coredump ([#2387](https://github.com/swoole/swoole-src/issues/2387)) ([@matyhtf](https://github.com/matyhtf)) * 修复Http2客户端header名传入数字时产生的coredump ([#2375](https://github.com/swoole/swoole-src/pull/2375)) ([@mabu233](https://github.com/mabu233)) * 修复`Swoole\Event::Dispatch`行为不符合预期 ([#2390](https://github.com/swoole/swoole-src/issues/2390)) ([@matyhtf](https://github.com/matyhtf)) * 修复PHP7.0.x极低版本下编译失败 ([`768b8a7`](https://github.com/swoole/swoole-src/commit/768b8a708ce7acfe2fecd327a525085cfc746703)) ([@shiguangqi](https://github.com/shiguangqi)) * 修复Socks5代理握手失败 ([`94ef96c`](https://github.com/swoole/swoole-src/commit/94ef96ce700bd4dd03946961e4553f24bf3c9446)) ([@twose](https://github.com/twose)) * 修复低版本LINUX内核下连接失败导致的内存读错误 ([`5adf625`](https://github.com/swoole/swoole-src/commit/5adf625fc34c6e997eba0495cb209ec4e19c0e60)) ([@matyhtf](https://github.com/matyhtf)&[@twose](https://github.com/twose)) * 修复Server在BASE单进程模式下在master进程使用定时器无效的问题 ([`82eca13`](https://github.com/swoole/swoole-src/commit/82eca138333fa0a4bb6ef2df319837281c9c7720)) ([@twose](https://github.com/twose)) * 修复由于低版本ZendAPI不稳定可能导致的编译不通过的问题 ([`768b8a7`](https://github.com/swoole/swoole-src/commit/768b8a708ce7acfe2fecd327a525085cfc746703)) ([@shiguangqi](https://github.com/shiguangqi)) * 修复调用sendto时返回EINVAL ([#2395](https://github.com/swoole/swoole-src/pull/2395)) ([@junwei](https://github.com/junwei)) ## 禁止 * 禁止在使用异步文件IO后创建Server或创建自定义进程 * 禁止在协程内创建Server或创建自定义进程 ## 移除 * `Websocket\Server->exists`只判断连接是否存在, 请使用`isEstablished`方法判断是否为Websocket客户端 * 移除`swoole.fast_serialize`配置项 * 移除了协程客户端方法调用失败时产生的Warning, 统一使用返回值和错误码判断 * 移除`Server->gzip`方法 * 移除`PicoHttpParser`支持 ## 移除异步模块 移除所有异步模块, 分离异步扩展到[async-ext](https://github.com/swoole/async-ext)移除的异步模块如下: * Async系列函数 * MySQL * Redis * Http\\Client * Memory\\Pool * MsgQueue * RingQueue ## 单元测试 * 测试支持在任意装有docker的主机上运行并自动部署基于docker的swoole/mysql/redis容器, 详情参阅源码目录下travis文件夹内的README文档