]> Cypherpunks repositories - gostls13.git/commitdiff
netchan: graceful handling of closed connection
authorGraham Miller <graham.miller@gmail.com>
Tue, 8 Feb 2011 20:42:31 +0000 (12:42 -0800)
committerRob Pike <r@golang.org>
Tue, 8 Feb 2011 20:42:31 +0000 (12:42 -0800)
Currently, when an importer closes the connection, the exporter gives an
error message 'netchan export: error decoding client header:EOF'.  This
change causes the exporter to look for an EOF during the parse of the
header, and silences the log message in that case.

R=r
CC=golang-dev, rog
https://golang.org/cl/4132044

src/pkg/netchan/export.go

index 0b28536edfe4bbdad8d480b4b00686c490636624..675e252d5c32b768eb28d208b9ac0dff26eff173 100644 (file)
@@ -118,7 +118,9 @@ func (client *expClient) run() {
        for {
                *hdr = header{}
                if err := client.decode(hdrValue); err != nil {
-                       expLog("error decoding client header:", err)
+                       if err != os.EOF {
+                               expLog("error decoding client header:", err)
+                       }
                        break
                }
                switch hdr.PayloadType {