1
0
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:
Darien Raymond 2018-09-10 20:06:58 +02:00
parent b1e900a506
commit 929a5d5d42
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -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
}
}