[client:client] cleanup

This commit is contained in:
xdrm-brackets 2018-04-22 21:04:06 +02:00
parent 96a9dbe785
commit 18c9a9951a
1 changed files with 6 additions and 18 deletions

View File

@ -99,12 +99,8 @@ func (c *T) Receive(r io.Reader) error {
---------------------------------------------------------*/ ---------------------------------------------------------*/
errCode := make([]byte, 1) errCode := make([]byte, 1)
read, err := r.Read(errCode) read, err := r.Read(errCode)
if err != nil { if err != nil { return err }
return err if uint16(read) != 1 { return errors.New("Cannot read enough bytes") }
}
if uint16(read) != 1 {
return errors.New("Cannot read enough bytes")
}
/* (2) Manage success /* (2) Manage success
---------------------------------------------------------*/ ---------------------------------------------------------*/
@ -128,22 +124,14 @@ func (c *T) Receive(r io.Reader) error {
/* (1) Read y1 */ /* (1) Read y1 */
y1 := make([]byte, scha.HSIZE) y1 := make([]byte, scha.HSIZE)
read, err = r.Read(y1) read, err = r.Read(y1)
if err != nil { if err != nil { return err }
return err if uint16(read) != scha.HSIZE { return errors.New("Cannot read enough bytes") }
}
if uint16(read) != scha.HSIZE {
return errors.New("Cannot read enough bytes")
}
/* (2) Read y2 */ /* (2) Read y2 */
y2 := make([]byte, scha.HSIZE) y2 := make([]byte, scha.HSIZE)
read, err = r.Read(y2) read, err = r.Read(y2)
if err != nil { if err != nil { return err }
return err if uint16(read) != scha.HSIZE { return errors.New("Cannot read enough bytes") }
}
if uint16(read) != scha.HSIZE {
return errors.New("Cannot read enough bytes")
}
/* (3) Manage rescue mode */ /* (3) Manage rescue mode */
err = c.rescue(y1, y2) err = c.rescue(y1, y2)