|
|
d874f97765
|
fix(handler): 修复 sendfile 高并发下的连接断开处理
- EPIPE/ECONNRESET 不再 fallback,直接返回错误避免响应混乱
- 正确处理 EAGAIN/EWOULDBLOCK socket 缓冲区满,等待重试
- EINTR 信号中断正确重试
- 改用 SetBodyStream 确保 HTTP 头先发送再 sendfile
- 添加重试限制(100次)防止无限循环
测试结果:0 错误/100000 并发请求
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-16 09:54:08 +08:00 |
|
|
|
d21e27fbac
|
fix(lint): 修复 golangci-lint 错误 (119 -> 0 issues)
主要修复:
- errcheck: defer Close 使用 //nolint:errcheck,类型断言改为 ok 检查
- govet fieldalignment: 调整结构体字段顺序优化内存布局
- revive unused-parameter: 将未使用参数改为 _
- exhaustive: 添加缺失的 switch case 或 default
- goconst: 提取重复字符串为常量 (accessAllow, accessDeny 等)
- staticcheck SA9003: 修复空分支逻辑
- gofmt: 运行 gofmt -w 格式化
- nolintlint: 修复 nolint 注释格式
其他改进:
- 更新 .golangci.yml 配置,启用更严格的检查
- 移除未使用的代码和导入
- 简化测试辅助函数调用
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-13 16:15:31 +08:00 |
|
|
|
bb77fa6a98
|
fix(lint): 修复 handler 和 http2 模块 lint 错误
- 添加 nolint:errcheck 注释到 defer Close 调用
- 修复 websocket.go 中重复的 nolint 注释格式
- 添加 staticcheck SA1019 nolint 注释到 deprecated WriteScheduler
- 移除 sendfile_linux.go 中未使用的 platformLinux 常量
- 添加文件末尾换行符
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-13 09:51:30 +08:00 |
|
|
|
92ef122226
|
refactor(handler): 拆分 sendfile 实现为平台特定文件
- Linux 平台保留 sendfile 系统调用的零拷贝实现
- 非 Linux 平台使用普通 IO fallback
- 分离平台特定测试到独立文件
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-12 11:45:46 +08:00 |
|