Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

tcpNoDelay选项无效 #4227

Closed
HeXis-YS opened this issue Dec 30, 2024 · 6 comments
Closed

tcpNoDelay选项无效 #4227

HeXis-YS opened this issue Dec 30, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@HeXis-YS
Copy link

在Xray-core中,tcpNoDelay选项用于启用/禁用TCP_NODELAY。而在代码中,只写了启用TCP_NODELAY的逻辑。

if config.TcpNoDelay {
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_NODELAY, 1); err != nil {
return errors.New("failed to set TCP_NODELAY", err)
}
}

根据Go的代码,TCP_NODELAY默认是启用的。
https://github.com/golang/go/blob/194de8fbfaf4c3ed54e1a3c1b14fc67a830b8d95/src/net/tcpsock.go#L289-L290
因此,用户无法通过tcpNoDelay禁用TCP_NODELAY但仍然可以通过customSockopt禁用
希望开发者可以修复这个问题(以及文档)。

@Fangliding Fangliding added the bug Something isn't working label Dec 30, 2024
@Fangliding
Copy link
Member

有点道理 回头改成默认true填false显式禁用吧

@RPRX
Copy link
Member

RPRX commented Dec 31, 2024

默认true填false显式禁用吧

#3871 (comment)

我们不要搞默认值为 true 的吧,可以把 tcpNoDelay 删掉,由 customSockopt 禁用

@RPRX
Copy link
Member

RPRX commented Dec 31, 2024

今天我还要改下 XMUX,然后发个真 · 24 最后一版

@Fangliding
Copy link
Member

我还以为按照以前的命名规则要noTcpNoDelay呢()
直接删好像确实好些

@RPRX
Copy link
Member

RPRX commented Dec 31, 2024

#2021 (comment)

这个 PR 引入的无意义选项,无人用,@Fangliding 你开个 PR 删一下它吧

@RPRX
Copy link
Member

RPRX commented Dec 31, 2024

总之 Xray 遵循 填 false/0/"" == 没填 == 要取默认值

@RPRX RPRX closed this as completed in 369d894 Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants