mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
fix sockopt for windows
This commit is contained in:
parent
b1e900a506
commit
929a5d5d42
@ -13,11 +13,11 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
||||
if strings.HasPrefix(network, "tcp") {
|
||||
switch config.Tfo {
|
||||
case SocketConfig_Enable:
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
||||
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
case SocketConfig_Disable:
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
||||
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -30,11 +30,11 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
||||
if strings.HasPrefix(network, "tcp") {
|
||||
switch config.Tfo {
|
||||
case SocketConfig_Enable:
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
||||
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
case SocketConfig_Disable:
|
||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
||||
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_TCP, TCP_FASTOPEN, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user