Commit c701c38e authored by Rob Pike's avatar Rob Pike

fixes for rpc:

- don't log normal EOF
- fix ServeConn to block as documented

R=rsc, msolo
CC=golang-dev
https://golang.org/cl/886043
parent d9254d00
...@@ -313,7 +313,9 @@ func (server *serverType) input(conn io.ReadWriteCloser) { ...@@ -313,7 +313,9 @@ func (server *serverType) input(conn io.ReadWriteCloser) {
err := dec.Decode(req) err := dec.Decode(req)
if err != nil { if err != nil {
if err == os.EOF || err == io.ErrUnexpectedEOF { if err == os.EOF || err == io.ErrUnexpectedEOF {
log.Stderr("rpc: ", err) if err == io.ErrUnexpectedEOF {
log.Stderr("rpc: ", err)
}
break break
} }
s := "rpc: server cannot decode request: " + err.String() s := "rpc: server cannot decode request: " + err.String()
...@@ -377,7 +379,7 @@ func Register(rcvr interface{}) os.Error { return server.register(rcvr) } ...@@ -377,7 +379,7 @@ func Register(rcvr interface{}) os.Error { return server.register(rcvr) }
// ServeConn runs the server on a single connection. When the connection // ServeConn runs the server on a single connection. When the connection
// completes, service terminates. ServeConn blocks; the caller typically // completes, service terminates. ServeConn blocks; the caller typically
// invokes it in a go statement. // invokes it in a go statement.
func ServeConn(conn io.ReadWriteCloser) { go server.input(conn) } func ServeConn(conn io.ReadWriteCloser) { server.input(conn) }
// Accept accepts connections on the listener and serves requests // Accept accepts connections on the listener and serves requests
// for each incoming connection. Accept blocks; the caller typically // for each incoming connection. Accept blocks; the caller typically
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment