]> Cypherpunks repositories - gostls13.git/commit
package net cleanup
authorRuss Cox <rsc@golang.org>
Tue, 3 Nov 2009 02:37:30 +0000 (18:37 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 3 Nov 2009 02:37:30 +0000 (18:37 -0800)
commitc83b838641649230d3cbb8be83fc4159949c29a2
tree34addcd47401db47aac916688b90b8be55850c40
parent6e8184d8cd53e76e7f9f9366c06f0441c5b5aa4c
package net cleanup

added ReadFrom/WriteTo for packet protocols like UDP.
simplified the net.Conn interface.
added new net.PacketConn interface for packet protocols.
implemented proper UDP listener.

cleaned up LocalAddr/RemoteAddr methods - cache in netFD.

threw away various unused methods.

an interface change:
introduced net.Addr as a network address interface,
to avoid conversion of UDP host:port to string and
back for every ReadFrom/WriteTo sequence.

another interface change:
since signature of Listener.Accept was changing anyway,
dropped the middle return value, because it is available
as c.RemoteAddr().  (the Accept signature predates the
existence of that method.)

Dial and Listen still accept strings, but the proto-specific
versions DialTCP, ListenUDP, etc. take net.Addr instead.

because the generic Dial didn't change and because
no one calls Accept directly (only indirectly via the http
server), very little code will be affected by these interface
changes.

design comments welcome.

R=p
CC=go-dev, r
http://go/go-review/1018017
17 files changed:
src/pkg/http/server.go
src/pkg/net/Makefile
src/pkg/net/dialgoogle_test.go
src/pkg/net/dnsclient.go
src/pkg/net/fd.go
src/pkg/net/ip.go
src/pkg/net/ipsock.go
src/pkg/net/net.go
src/pkg/net/server_test.go
src/pkg/net/sock.go
src/pkg/net/tcpsock.go [new file with mode: 0644]
src/pkg/net/udpsock.go [new file with mode: 0644]
src/pkg/net/unixsock.go
src/pkg/os/error.go
src/pkg/rpc/client.go
src/pkg/rpc/server.go
src/pkg/rpc/server_test.go