1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:41:21 -06:00
Commit Graph

44 Commits

Author SHA1 Message Date
Mikio Hara
39a7017c26 net: make deadline helpers join to netFD as its methods
Just for readability reasons; to prevent overlooking deadline stuff
across over platforms.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8656044
2013-08-13 20:00:58 +09:00
Mikio Hara
db84a450d7 net: move InvalidAddrError type into net.go
Probably we should remove this type before Go 1 contract has settled,
but too late. Instead, keep InvalidAddrError close to package generic
error types.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12670044
2013-08-10 09:46:22 +09:00
Mikio Hara
a0a45bbb71 net: consolidate listenerBacklog declaration
Also adds maxListenerBacklog placeholder for Plan 9.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11674044
2013-07-24 08:43:08 +09:00
Brad Fitzpatrick
158a0353f7 net: document OpError
Fixes #4797

R=adg, rsc
CC=golang-dev
https://golang.org/cl/7300099
2013-02-14 09:29:34 -08:00
Rick Arnold
5416e6e916 net: document that File reverts connection to blocking mode.
Fixes #2458.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/6869054
2012-12-05 23:31:35 -05:00
Dave Cheney
9fb96991e6 net: fix data races on deadline vars
Fixes #4434.

This proposal replaces the previous CL 6855110. Due to issue 599, 64-bit atomic operations should probably be avoided, so use a sync.Mutex instead.

Benchmark comparisons against 025b9d070a85 on linux/386:

CL 6855110:

benchmark                        old ns/op    new ns/op    delta
BenchmarkTCPOneShot                 710024       727409   +2.45%
BenchmarkTCPOneShotTimeout          758178       768620   +1.38%
BenchmarkTCPPersistent              223464       228058   +2.06%
BenchmarkTCPPersistentTimeout       234494       242600   +3.46%

This proposal:

benchmark                        old ns/op    new ns/op    delta
BenchmarkTCPOneShot                 710024       718492   +1.19%
BenchmarkTCPOneShotTimeout          758178       748783   -1.24%
BenchmarkTCPPersistent              223464       227628   +1.86%
BenchmarkTCPPersistentTimeout       234494       238321   +1.63%

R=rsc, dvyukov, mikioh.mikioh, alex.brainman, bradfitz
CC=golang-dev, remyoudompheng
https://golang.org/cl/6866050
2012-12-05 15:59:01 +11:00
Anthony Martin
253ed02918 net: update docs and sync API for Plan 9
R=golang-dev, dave, mikioh.mikioh, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6674043
2012-11-30 11:41:50 -08:00
Mikio Hara
306afc7725 net: consolidate common socket functions for Plan 9
This CL extends changeset 13126:fc4a62e14aba to Plan 9.

R=ality, golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6820124
2012-11-13 16:18:37 +09:00
Brad Fitzpatrick
ef6806fb13 net: close fds eagerly in DialTimeout
Integrates with the pollserver now.

Uses the old implementation on windows and plan9.

Fixes #2631

R=paul, iant, adg, bendaglish, rsc
CC=golang-dev
https://golang.org/cl/6815049
2012-11-08 10:35:16 -06:00
Alex Brainman
84e20465fc net: use better error messages on windows
Fixes #4320.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6810064
2012-11-02 11:07:22 +11:00
Russ Cox
babbf941c9 net, net/rpc, reflect, time: document concurrency guarantees
Fixes #1599.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5777043
2012-03-07 14:55:09 -05:00
Brad Fitzpatrick
8729d158ca net: more docs on deadlines
Fixes #2777

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5685060
2012-02-21 11:11:18 +11:00
Brad Fitzpatrick
008e64da39 net: package doc overview / examples
Fixes #2774

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673076
2012-02-17 13:07:06 +11:00
Brad Fitzpatrick
549ca930a0 net: move DNSConfigError to a portable file
The type being unavailable on Windows was the only API
signature difference in the net package.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5608043
2012-01-31 13:01:34 -08:00
Mikio Hara
3d400db5de net: update comments to remove redundant "net" prefix
R=rsc, r
CC=golang-dev
https://golang.org/cl/5569087
2012-01-29 19:11:05 +09:00
Mikio Hara
2356e43827 net: fix comments
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5557059
2012-01-19 12:23:30 +09:00
Brad Fitzpatrick
b71883e9b0 net: change SetTimeout to SetDeadline
Previously, a timeout (in int64 nanoseconds) applied to a granularity
even smaller than one operation:  a 100 byte read with a 1 second timeout
could take 100 seconds, if the bytes all arrived on the network 1 second
apart.  This was confusing.

Rather than making the timeout granularity be per-Read/Write,
this CL makes callers set an absolute deadline (in time.Time)
after which operations will fail.  This makes it possible to
set deadlines at higher levels, without knowing exactly how
many read/write operations will happen in e.g. reading an HTTP
request.

Fixes #2723

R=r, rsc, dave
CC=golang-dev
https://golang.org/cl/5555048
2012-01-18 16:24:06 -08:00
Brad Fitzpatrick
01507b9ad1 net: fix Windows build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5505048
2011-12-20 14:32:33 -08:00
Russ Cox
eb6929299b src/pkg/[n-z]*: gofix -r error -force=error
R=golang-dev, bsiegert, iant
CC=golang-dev
https://golang.org/cl/5294074
2011-11-01 22:05:34 -04:00
Robert Griesemer
712fb6dcd3 os.Error API: don't export os.ErrorString, use os.NewError consistently
This is a core API change.

1) gofix misc src
2) Manual adjustments to the following files under src/pkg:
   gob/decode.go
   rpc/client.go
   os/error.go
   io/io.go
   bufio/bufio.go
   http/request.go
   websocket/client.go
as well as:
   src/cmd/gofix/testdata/*.go.in (reverted)
   test/fixedbugs/bug243.go
3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go)

Compiles and runs all tests.

R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/4607052
2011-06-22 10:52:47 -07:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Russ Cox
dd7403b1b8 net: remove comment fragments
I have no idea how I meant to complete that sentence.

R=r, r2
CC=golang-dev
https://golang.org/cl/4191046
2011-02-17 16:32:50 -05:00
Andrew Gerrand
fc4ba1546c net: add nil checks to several String methods to avoid panics
Fixes #945.

R=r
CC=golang-dev
https://golang.org/cl/1848049
2010-07-27 17:22:22 +10:00
Russ Cox
f374575fb7 net: move Dial, Listen out of net.go.
now net.go is only type definitions, not active code.

R=r
CC=golang-dev
https://golang.org/cl/1708046
2010-06-21 19:52:30 -07:00
Andrew Gerrand
a63f73c196 net: fix typo
Fixes #819.

R=rsc
CC=golang-dev
https://golang.org/cl/1421041
2010-05-31 07:05:41 +02:00
Christopher Wedgwood
13d5a19a98 net: implement raw sockets
R=rsc
CC=golang-dev
https://golang.org/cl/684041
2010-05-21 17:30:40 -07:00
Russ Cox
47a0533411 net: introduce net.Error interface
Adds two more methods, Timeout and Temporary.
Implemented by os.Errno too.  The intent is to make
the checks for os.EAGAIN a little less clunky.
It should also let us clean up a bug that Mike Solomon
pointed out: if a network server gets an "out of file descriptors"
error from Accept, the listener should not stop.
It will be able to check this because that error would
have Temporary() == true.

Also clean up some underscore names.

Fixes #442.

R=r
CC=golang-dev, msolo
https://golang.org/cl/957045
2010-04-26 22:15:25 -07:00
Roger Peppe
0281b71580 net: make Dial correctly return nil on error.
R=rsc
CC=golang-dev
https://golang.org/cl/181135
2010-01-05 09:20:02 -08:00
Robert Griesemer
a3d1045fb7 1) Change default gofmt default settings for
parsing and printing to new syntax.

   Use -oldparser to parse the old syntax,
   use -oldprinter to print the old syntax.

2) Change default gofmt formatting settings
   to use tabs for indentation only and to use
   spaces for alignment. This will make the code
   alignment insensitive to an editor's tabwidth.

   Use -spaces=false to use tabs for alignment.

3) Manually changed src/exp/parser/parser_test.go
   so that it doesn't try to parse the parser's
   source files using the old syntax (they have
   new syntax now).

4) gofmt -w src misc test/bench

3rd set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180048
2009-12-15 15:35:38 -08:00
Robert Griesemer
3bb0032cd6 - replaced gofmt expression formatting algorithm with
rsc's algorithm
- applied gofmt -w misc src
- partial CL (last chunk)

R=rsc, r
http://go/go-review/1024041
2009-11-09 21:23:52 -08:00
Robert Griesemer
40621d5c0d remove semis after statements in one-statement statement lists
R=rsc, r
http://go/go-review/1025029
2009-11-09 12:07:39 -08:00
Rob Pike
40a7db3ee9 add top-level package comments for net, reflect, malloc.
reflect is a little more detailed than some because it affords an opportunity
to explain how to approach the library.

R=gri, rsc
CC=go-dev
http://go/go-review/1026026
2009-11-08 15:57:25 -08:00
Robert Griesemer
368f8cbc75 - fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)

R=r, rsc
CC=go-dev
http://go/go-review/1026006
2009-11-06 14:24:38 -08:00
Robert Griesemer
5d37705416 gofmt-ify net
R=rsc
http://go/go-review/1017045
2009-11-04 23:16:46 -08:00
Russ Cox
c83b838641 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
2009-11-02 18:37:30 -08:00
Russ Cox
35ace1d1f5 split ipsock.go, sock.go, and unixsock.go out of net.go
prior to cleanup.  no changes, only moving.

remove dependencies on strconv and strings

R=r
http://go/go-review/1017010
2009-11-01 11:15:34 -08:00
Russ Cox
ca6a0fee1b more "declared and not used".
the last round omitted := range and only
checked 1 out of N vars in a multi-var :=

R=r
OCL=34624
CL=34638
2009-09-15 09:41:59 -07:00
Russ Cox
28eba4877b fix "declared and not used" errors in non-test code.
R=r
DELTA=112  (6 added, 57 deleted, 49 changed)
OCL=34610
CL=34610
2009-09-14 17:20:29 -07:00
Russ Cox
b04ac108fd convert non-low-level non-google pkg code
to whole-package compilation.

R=r
OCL=33070
CL=33101
2009-08-12 13:19:17 -07:00
Russ Cox
55e790a160 clean up some BUG/TODO in go code
R=r
DELTA=23  (1 added, 12 deleted, 10 changed)
OCL=30957
CL=30980
2009-07-01 07:32:04 -07:00
Russ Cox
a0bcaf4c00 Change os.Error convention:
echo back context of call in error if likely to be useful.

For example, if os.Open("/etc/passwd", os.O_RDONLY)
fails with syscall.EPERM, it returns as the os.Error

	&PathError{
		Op: "open",
		Path: "/etc/passwd"
		Error: os.EPERM
	}

which formats as

	open /etc/passwd: permission denied

Not converted:

	datafmt
	go/...
	google/...
	regexp
	tabwriter
	template

R=r
DELTA=1153  (561 added, 156 deleted, 436 changed)
OCL=30738
CL=30781
2009-06-25 20:24:55 -07:00
Rob Pike
efc4088ccd make IP address available
R=rsc
DELTA=30  (30 added, 0 deleted, 0 changed)
OCL=30536
CL=30536
2009-06-19 16:03:59 -07:00
Russ Cox
5d2ee9d90a add Addr() string to net.Listener interface.
use it to avoid use of fixed ports in tests.
convert google/net/rpc to gotest

R=r
DELTA=523  (275 added, 229 deleted, 19 changed)
OCL=30458
CL=30460
2009-06-17 21:44:26 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00