mirror of https://github.com/schollz/croc.git
purge errors on successful transfer
This commit is contained in:
parent
19efe8b77a
commit
6f5225ac91
|
@ -69,6 +69,7 @@ type Client struct {
|
||||||
Step3RecipientRequestFile bool
|
Step3RecipientRequestFile bool
|
||||||
Step4FileTransfer bool
|
Step4FileTransfer bool
|
||||||
Step5CloseChannels bool
|
Step5CloseChannels bool
|
||||||
|
SuccessfulTransfer bool
|
||||||
|
|
||||||
// send / receive information of all files
|
// send / receive information of all files
|
||||||
FilesToTransfer []FileInfo
|
FilesToTransfer []FileInfo
|
||||||
|
@ -385,6 +386,10 @@ func (c *Client) transfer(options TransferOptions) (err error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// purge errors that come from succesful transfer
|
||||||
|
if c.SuccessfulTransfer {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
|
||||||
if c.Options.Stdout && !c.Options.IsSender {
|
if c.Options.Stdout && !c.Options.IsSender {
|
||||||
pathToFile := path.Join(
|
pathToFile := path.Join(
|
||||||
|
@ -408,6 +413,7 @@ func (c *Client) processMessage(payload []byte) (done bool, err error) {
|
||||||
Type: "finished",
|
Type: "finished",
|
||||||
})
|
})
|
||||||
done = true
|
done = true
|
||||||
|
c.SuccessfulTransfer = true
|
||||||
return
|
return
|
||||||
case "pake":
|
case "pake":
|
||||||
log.Debug("received pake payload")
|
log.Debug("received pake payload")
|
||||||
|
@ -585,6 +591,7 @@ func (c *Client) updateState() (err error) {
|
||||||
// find the next file to transfer and send that number
|
// find the next file to transfer and send that number
|
||||||
// if the files are the same size, then look for missing chunks
|
// if the files are the same size, then look for missing chunks
|
||||||
finished := true
|
finished := true
|
||||||
|
|
||||||
for i, fileInfo := range c.FilesToTransfer {
|
for i, fileInfo := range c.FilesToTransfer {
|
||||||
if i < c.FilesToTransferCurrentNum {
|
if i < c.FilesToTransferCurrentNum {
|
||||||
continue
|
continue
|
||||||
|
@ -609,6 +616,7 @@ func (c *Client) updateState() (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
c.SuccessfulTransfer = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// start initiating the process to receive a new file
|
// start initiating the process to receive a new file
|
||||||
|
|
Loading…
Reference in New Issue