From 72d7151a721ce182f4a13e7e5a6f5ced2f468c17 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 16 Jan 2015 15:57:32 +0000 Subject: net: Restore earlier Solaris-specific version of setKeepAlivePeriod. The version from the master repository seems to be appropriate for OpenSolaris but not for Solaris itself. Solaris 11.2 proper does not define TCP_KEEPIDLE or TCP_KEEPINTVL. From-SVN: r219749 --- libgo/go/net/tcpsockopt_solaris.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 libgo/go/net/tcpsockopt_solaris.go (limited to 'libgo/go') diff --git a/libgo/go/net/tcpsockopt_solaris.go b/libgo/go/net/tcpsockopt_solaris.go new file mode 100644 index 0000000..eaab6b6 --- /dev/null +++ b/libgo/go/net/tcpsockopt_solaris.go @@ -0,0 +1,27 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// TCP socket options for solaris + +package net + +import ( + "os" + "syscall" + "time" +) + +// Set keep alive period. +func setKeepAlivePeriod(fd *netFD, d time.Duration) error { + if err := fd.incref(); err != nil { + return err + } + defer fd.decref() + + // The kernel expects seconds so round to next highest second. + d += (time.Second - time.Nanosecond) + secs := int(d.Seconds()) + + return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.SO_KEEPALIVE, secs)) +} -- cgit v1.1