2016-07-22 20:15:38 +02:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
2013-11-06 20:49:01 +01:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2019-02-01 22:57:36 +01:00
|
|
|
// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris windows
|
2013-11-06 20:49:01 +01:00
|
|
|
|
|
|
|
package net
|
|
|
|
|
|
|
|
import (
|
2017-09-14 19:11:35 +02:00
|
|
|
"runtime"
|
2013-11-06 20:49:01 +01:00
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
func setNoDelay(fd *netFD, noDelay bool) error {
|
2017-09-14 19:11:35 +02:00
|
|
|
err := fd.pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_NODELAY, boolint(noDelay))
|
|
|
|
runtime.KeepAlive(fd)
|
|
|
|
return wrapSyscallError("setsockopt", err)
|
2013-11-06 20:49:01 +01:00
|
|
|
}
|