diff options
Diffstat (limited to 'src/pkg/net')
-rw-r--r-- | src/pkg/net/dnsclient.go | 4 | ||||
-rw-r--r-- | src/pkg/net/dnsmsg.go | 8 | ||||
-rw-r--r-- | src/pkg/net/fd.go | 4 | ||||
-rw-r--r-- | src/pkg/net/fd_darwin.go | 4 | ||||
-rw-r--r-- | src/pkg/net/fd_nacl.go | 7 | ||||
-rw-r--r-- | src/pkg/net/ipsock.go | 4 | ||||
-rw-r--r-- | src/pkg/net/net.go | 4 | ||||
-rw-r--r-- | src/pkg/net/parse.go | 8 | ||||
-rw-r--r-- | src/pkg/net/tcpsock.go | 16 | ||||
-rw-r--r-- | src/pkg/net/timeout_test.go | 4 | ||||
-rw-r--r-- | src/pkg/net/udpsock.go | 17 | ||||
-rw-r--r-- | src/pkg/net/unixsock.go | 12 |
12 files changed, 23 insertions, 69 deletions
diff --git a/src/pkg/net/dnsclient.go b/src/pkg/net/dnsclient.go index 3c283001b..4a3b7dcc1 100644 --- a/src/pkg/net/dnsclient.go +++ b/src/pkg/net/dnsclient.go @@ -178,9 +178,7 @@ func tryOneName(cfg *_DNS_Config, name string) (addrs []string, err os.Error) { var cfg *_DNS_Config var dnserr os.Error -func loadConfig() { - cfg, dnserr = _DNS_ReadConfig(); -} +func loadConfig() { cfg, dnserr = _DNS_ReadConfig() } func isDomainName(s string) bool { // Requirements on DNS name: diff --git a/src/pkg/net/dnsmsg.go b/src/pkg/net/dnsmsg.go index 93ab3aac0..c7c27e344 100644 --- a/src/pkg/net/dnsmsg.go +++ b/src/pkg/net/dnsmsg.go @@ -231,9 +231,7 @@ type _DNS_RR_A struct { A uint32 "ipv4"; } -func (rr *_DNS_RR_A) Header() *_DNS_RR_Header { - return &rr.Hdr; -} +func (rr *_DNS_RR_A) Header() *_DNS_RR_Header { return &rr.Hdr } // Packing and unpacking. @@ -521,9 +519,7 @@ func printStructValue(val *reflect.StructValue) string { return s; } -func printStruct(any interface{}) string { - return printStructValue(structValue(any)); -} +func printStruct(any interface{}) string { return printStructValue(structValue(any)) } // Resource record packer. func packRR(rr _DNS_RR, msg []byte, off int) (off2 int, ok bool) { diff --git a/src/pkg/net/fd.go b/src/pkg/net/fd.go index 3c326461a..bcb737212 100644 --- a/src/pkg/net/fd.go +++ b/src/pkg/net/fd.go @@ -270,9 +270,7 @@ func (s *pollServer) Run() { var wakeupbuf [1]byte -func (s *pollServer) Wakeup() { - s.pw.Write(&wakeupbuf); -} +func (s *pollServer) Wakeup() { s.pw.Write(&wakeupbuf) } func (s *pollServer) WaitRead(fd *netFD) { s.cr <- fd; diff --git a/src/pkg/net/fd_darwin.go b/src/pkg/net/fd_darwin.go index 8ae9f687c..45acad699 100644 --- a/src/pkg/net/fd_darwin.go +++ b/src/pkg/net/fd_darwin.go @@ -107,6 +107,4 @@ func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) { return fd, mode, nil; } -func (p *pollster) Close() os.Error { - return os.NewSyscallError("close", syscall.Close(p.kq)); -} +func (p *pollster) Close() os.Error { return os.NewSyscallError("close", syscall.Close(p.kq)) } diff --git a/src/pkg/net/fd_nacl.go b/src/pkg/net/fd_nacl.go index 36a012b2a..316796486 100644 --- a/src/pkg/net/fd_nacl.go +++ b/src/pkg/net/fd_nacl.go @@ -23,14 +23,11 @@ func (p *pollster) AddFD(fd int, mode int, repeat bool) os.Error { func (p *pollster) StopWaiting(fd int, bits uint) { } -func (p *pollster) DelFD(fd int, mode int) { -} +func (p *pollster) DelFD(fd int, mode int) {} func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) { _, err = newpollster(); return; } -func (p *pollster) Close() os.Error { - return nil; -} +func (p *pollster) Close() os.Error { return nil } diff --git a/src/pkg/net/ipsock.go b/src/pkg/net/ipsock.go index 76a64e76e..fd37155a2 100644 --- a/src/pkg/net/ipsock.go +++ b/src/pkg/net/ipsock.go @@ -30,9 +30,7 @@ var preferIPv4 = !kernelSupportsIPv6() // TODO(rsc): if syscall.OS == "linux", we're supposd to read // /proc/sys/net/core/somaxconn, // to take advantage of kernels that have raised the limit. -func listenBacklog() int { - return syscall.SOMAXCONN; -} +func listenBacklog() int { return syscall.SOMAXCONN } // Internet sockets (TCP, UDP) diff --git a/src/pkg/net/net.go b/src/pkg/net/net.go index 9c3762ae4..d649756ed 100644 --- a/src/pkg/net/net.go +++ b/src/pkg/net/net.go @@ -266,6 +266,4 @@ func (e *AddrError) String() string { type UnknownNetworkError string -func (e UnknownNetworkError) String() string { - return "unknown network " + string(e); -} +func (e UnknownNetworkError) String() string { return "unknown network " + string(e) } diff --git a/src/pkg/net/parse.go b/src/pkg/net/parse.go index a9ba2d22e..9ed3f2dbd 100644 --- a/src/pkg/net/parse.go +++ b/src/pkg/net/parse.go @@ -17,9 +17,7 @@ type file struct { data []byte; } -func (f *file) close() { - f.file.Close(); -} +func (f *file) close() { f.file.Close() } func (f *file) getLineFromData() (s string, ok bool) { data := f.data; @@ -104,9 +102,7 @@ func splitAtBytes(s string, t string) []string { return a[0:n]; } -func getFields(s string) []string { - return splitAtBytes(s, " \r\t\n"); -} +func getFields(s string) []string { return splitAtBytes(s, " \r\t\n") } // Bigger than we need, not too big to worry about overflow const big = 0xFFFFFF diff --git a/src/pkg/net/tcpsock.go b/src/pkg/net/tcpsock.go index 2c84be03c..a49a73d1b 100644 --- a/src/pkg/net/tcpsock.go +++ b/src/pkg/net/tcpsock.go @@ -28,13 +28,9 @@ type TCPAddr struct { } // Network returns the address's network name, "tcp". -func (a *TCPAddr) Network() string { - return "tcp"; -} +func (a *TCPAddr) Network() string { return "tcp" } -func (a *TCPAddr) String() string { - return joinHostPort(a.IP.String(), itoa(a.Port)); -} +func (a *TCPAddr) String() string { return joinHostPort(a.IP.String(), itoa(a.Port)) } func (a *TCPAddr) family() int { if a == nil || len(a.IP) <= 4 { @@ -81,9 +77,7 @@ func newTCPConn(fd *netFD) *TCPConn { return c; } -func (c *TCPConn) ok() bool { - return c != nil && c.fd != nil; -} +func (c *TCPConn) ok() bool { return c != nil && c.fd != nil } // Implementation of the Conn interface - see Conn for documentation. @@ -283,6 +277,4 @@ func (l *TCPListener) Close() os.Error { } // Addr returns the listener's network address, a *TCPAddr. -func (l *TCPListener) Addr() Addr { - return l.fd.laddr; -} +func (l *TCPListener) Addr() Addr { return l.fd.laddr } diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go index 0e03b63f9..acac3c75d 100644 --- a/src/pkg/net/timeout_test.go +++ b/src/pkg/net/timeout_test.go @@ -28,9 +28,7 @@ func testTimeout(t *testing.T, network, addr string) { } } -func TestTimeoutUDP(t *testing.T) { - testTimeout(t, "udp", "127.0.0.1:53"); -} +func TestTimeoutUDP(t *testing.T) { testTimeout(t, "udp", "127.0.0.1:53") } func TestTimeoutTCP(t *testing.T) { // 74.125.19.99 is www.google.com. diff --git a/src/pkg/net/udpsock.go b/src/pkg/net/udpsock.go index f3b6bf6a4..4449e8379 100644 --- a/src/pkg/net/udpsock.go +++ b/src/pkg/net/udpsock.go @@ -28,14 +28,9 @@ type UDPAddr struct { } // Network returns the address's network name, "udp". -func (a *UDPAddr) Network() string { - return "udp"; -} - -func (a *UDPAddr) String() string { - return joinHostPort(a.IP.String(), itoa(a.Port)); +func (a *UDPAddr) Network() string { return "udp" } -} +func (a *UDPAddr) String() string { return joinHostPort(a.IP.String(), itoa(a.Port)) } func (a *UDPAddr) family() int { if a == nil || len(a.IP) <= 4 { @@ -76,13 +71,9 @@ type UDPConn struct { fd *netFD; } -func newUDPConn(fd *netFD) *UDPConn { - return &UDPConn{fd}; -} +func newUDPConn(fd *netFD) *UDPConn { return &UDPConn{fd} } -func (c *UDPConn) ok() bool { - return c != nil && c.fd != nil; -} +func (c *UDPConn) ok() bool { return c != nil && c.fd != nil } // Implementation of the Conn interface - see Conn for documentation. diff --git a/src/pkg/net/unixsock.go b/src/pkg/net/unixsock.go index b30d7f2d4..033f650c3 100644 --- a/src/pkg/net/unixsock.go +++ b/src/pkg/net/unixsock.go @@ -127,13 +127,9 @@ type UnixConn struct { fd *netFD; } -func newUnixConn(fd *netFD) *UnixConn { - return &UnixConn{fd}; -} +func newUnixConn(fd *netFD) *UnixConn { return &UnixConn{fd} } -func (c *UnixConn) ok() bool { - return c != nil && c.fd != nil; -} +func (c *UnixConn) ok() bool { return c != nil && c.fd != nil } // Implementation of the Conn interface - see Conn for documentation. @@ -400,9 +396,7 @@ func (l *UnixListener) Close() os.Error { } // Addr returns the listener's network address. -func (l *UnixListener) Addr() Addr { - return l.fd.laddr; -} +func (l *UnixListener) Addr() Addr { return l.fd.laddr } // ListenUnixgram listens for incoming Unix datagram packets addressed to the // local address laddr. The returned connection c's ReadFrom |