From 18c9a9951a2fc81e00cbd1c4802f779f53cf224e Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 22 Apr 2018 21:04:06 +0200 Subject: [PATCH] [client:client] cleanup --- src/git.xdrm.io/schastsp/client/client.go | 24 ++++++----------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/git.xdrm.io/schastsp/client/client.go b/src/git.xdrm.io/schastsp/client/client.go index a4c99e2..eeaa375 100644 --- a/src/git.xdrm.io/schastsp/client/client.go +++ b/src/git.xdrm.io/schastsp/client/client.go @@ -99,12 +99,8 @@ func (c *T) Receive(r io.Reader) error { ---------------------------------------------------------*/ errCode := make([]byte, 1) read, err := r.Read(errCode) - if err != nil { - return err - } - if uint16(read) != 1 { - return errors.New("Cannot read enough bytes") - } + if err != nil { return err } + if uint16(read) != 1 { return errors.New("Cannot read enough bytes") } /* (2) Manage success ---------------------------------------------------------*/ @@ -128,22 +124,14 @@ func (c *T) Receive(r io.Reader) error { /* (1) Read y1 */ y1 := make([]byte, scha.HSIZE) read, err = r.Read(y1) - if err != nil { - return err - } - if uint16(read) != scha.HSIZE { - return errors.New("Cannot read enough bytes") - } + if err != nil { return err } + if uint16(read) != scha.HSIZE { return errors.New("Cannot read enough bytes") } /* (2) Read y2 */ y2 := make([]byte, scha.HSIZE) read, err = r.Read(y2) - if err != nil { - return err - } - if uint16(read) != scha.HSIZE { - return errors.New("Cannot read enough bytes") - } + if err != nil { return err } + if uint16(read) != scha.HSIZE { return errors.New("Cannot read enough bytes") } /* (3) Manage rescue mode */ err = c.rescue(y1, y2)