[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)
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)