1
0
mirror of https://github.com/golang/go synced 2024-11-25 05:07:56 -07:00

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
This commit is contained in:
Rob Pike 2010-04-12 17:14:28 -07:00
parent d9254d00f9
commit c701c38e13

View File

@ -313,7 +313,9 @@ func (server *serverType) input(conn io.ReadWriteCloser) {
err := dec.Decode(req)
if err != nil {
if err == os.EOF || err == io.ErrUnexpectedEOF {
log.Stderr("rpc: ", err)
if err == io.ErrUnexpectedEOF {
log.Stderr("rpc: ", err)
}
break
}
s := "rpc: server cannot decode request: " + err.String()
@ -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
// completes, service terminates. ServeConn blocks; the caller typically
// 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
// for each incoming connection. Accept blocks; the caller typically