]> Cypherpunks repositories - gostls13.git/commitdiff
net: consolidate listenerBacklog declaration
authorMikio Hara <mikioh.mikioh@gmail.com>
Tue, 23 Jul 2013 23:43:08 +0000 (08:43 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Tue, 23 Jul 2013 23:43:08 +0000 (08:43 +0900)
Also adds maxListenerBacklog placeholder for Plan 9.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11674044

src/pkg/net/ipsock_plan9.go
src/pkg/net/net.go
src/pkg/net/sock_plan9.go [new file with mode: 0644]
src/pkg/net/sock_posix.go

index c7d542dabc6267fe96c5c31e97442e9805aead68..5be57ad6abc17c3c73ab14481787d1f68e75bd81 100644 (file)
@@ -12,9 +12,6 @@ import (
        "syscall"
 )
 
-// /sys/include/ape/sys/socket.h:/SOMAXCONN
-var listenerBacklog = 5
-
 // probeIPv6Stack returns two boolean values.  If the first boolean
 // value is true, kernel supports basic IPv6 functionality.  If the
 // second boolean value is true, kernel supports IPv6 IPv4-mapping.
index 72b2b646c48f8214c67b2a9f4cab7abe5743e44b..c077b4cc48cd60accef5876dc202f8ff84d61424 100644 (file)
@@ -259,6 +259,8 @@ type PacketConn interface {
        SetWriteDeadline(t time.Time) error
 }
 
+var listenerBacklog = maxListenerBacklog()
+
 // A Listener is a generic network listener for stream-oriented protocols.
 //
 // Multiple goroutines may invoke methods on a Listener simultaneously.
diff --git a/src/pkg/net/sock_plan9.go b/src/pkg/net/sock_plan9.go
new file mode 100644 (file)
index 0000000..88d9ed1
--- /dev/null
@@ -0,0 +1,10 @@
+// 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.
+
+package net
+
+func maxListenerBacklog() int {
+       // /sys/include/ape/sys/socket.h:/SOMAXCONN
+       return 5
+}
index beaa5c8b01e1444db39135ac2359ccdc043ce82c..98d9cbe600d489bc395e7dc6c6abb2ab9a725277 100644 (file)
@@ -11,8 +11,6 @@ import (
        "time"
 )
 
-var listenerBacklog = maxListenerBacklog()
-
 // Generic POSIX socket creation.
 func socket(net string, f, t, p int, ipv6only bool, ulsa, ursa syscall.Sockaddr, deadline time.Time, toAddr func(syscall.Sockaddr) Addr) (fd *netFD, err error) {
        s, err := sysSocket(f, t, p)