fix sockopt for windows

pull/1269/head
Darien Raymond 6 years ago
parent b1e900a506
commit 929a5d5d42
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -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…
Cancel
Save