net: consolidate listenerBacklog declaration

Also adds maxListenerBacklog placeholder for Plan 9.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11674044
This commit is contained in:
Mikio Hara 2013-07-24 08:43:08 +09:00
parent dba623b1c7
commit a0a45bbb71
4 changed files with 12 additions and 5 deletions

View 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.

View 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.

10
src/pkg/net/sock_plan9.go Normal file
View File

@ -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
}

View 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)