1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-23 23:54:17 +03:00

add transfer complete

This commit is contained in:
Zack Scholl 2018-09-22 06:29:11 -07:00
parent 66eeab25fb
commit 7513702e9c

View File

@ -37,11 +37,6 @@ func Send(done chan struct{}, c *websocket.Conn, fname string, codephrase string
if strings.HasPrefix(err.Error(), "websocket: close 100") {
err = nil
}
if err == nil {
fmt.Fprintf(os.Stderr, "Transfer complete")
} else {
fmt.Fprintf(os.Stderr, err.Error())
}
}
done <- struct{}{}
}
@ -204,8 +199,10 @@ func send(c *websocket.Conn, fname string, codephrase string) (err error) {
log.Debugf("[%d] determing whether it went ok", step)
if bytes.Equal(message, []byte("ok")) {
log.Debug("file transfered successfully")
fmt.Fprintf(os.Stderr, "\nTransfer complete")
return nil
} else {
fmt.Fprintf(os.Stderr, "\nTransfer corrupted")
return errors.New("file not transfered succesfully")
}
default: