summaryrefslogtreecommitdiffhomepage
path: root/server/sockopt.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/sockopt.go')
-rw-r--r--server/sockopt.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/sockopt.go b/server/sockopt.go
index 43602036..6361a7ae 100644
--- a/server/sockopt.go
+++ b/server/sockopt.go
@@ -1,3 +1,18 @@
+// Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+// implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package server
import (
@@ -51,7 +66,10 @@ func SetTcpMD5SigSockopts(l *net.TCPListener, address string, key string) error
_, _, e := syscall.Syscall6(syscall.SYS_SETSOCKOPT, fi.Fd(),
uintptr(syscall.IPPROTO_TCP), uintptr(TCP_MD5SIG),
uintptr(unsafe.Pointer(&t)), unsafe.Sizeof(t), 0)
- return e
+ if e > 0 {
+ return e
+ }
+ return nil
}
func SetTcpTTLSockopts(conn *net.TCPConn, ttl int) error {