mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
wait longer on an abnormal finish
This commit is contained in:
parent
d906630f3a
commit
c01bc56079
4 changed files with 8 additions and 3 deletions
|
@ -8,8 +8,10 @@ import (
|
|||
|
||||
func (c *Croc) cleanup() {
|
||||
c.cleanupTime = true
|
||||
time.Sleep(250 * time.Millisecond) // race condition, wait for
|
||||
if !c.normalFinish {
|
||||
time.Sleep(1000 * time.Millisecond) // race condition, wait for
|
||||
// sending/receiving to finish
|
||||
}
|
||||
// erase all the croc files and their possible numbers
|
||||
for i := 0; i < 16; i++ {
|
||||
fname := c.crocFile + "." + strconv.Itoa(i)
|
||||
|
|
|
@ -503,6 +503,7 @@ func (c *Croc) dialUp() (err error) {
|
|||
c.cs.channel.transferTime = time.Since(c.cs.channel.startTransfer)
|
||||
c.cs.Unlock()
|
||||
log.Debug("leaving dialup")
|
||||
c.normalFinish = true
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ type Croc struct {
|
|||
bothConnected bool
|
||||
// cleanupTime tells processes to close up
|
||||
cleanupTime bool
|
||||
normalFinish bool
|
||||
}
|
||||
|
||||
// Init will initialize the croc relay
|
||||
|
|
|
@ -32,6 +32,7 @@ func catFiles(files []string, outfile string, remove bool) error {
|
|||
}
|
||||
_, err = io.Copy(finished, fh)
|
||||
if err != nil {
|
||||
fh.Close()
|
||||
return errors.Wrap(err, "CatFiles copy: ")
|
||||
}
|
||||
fh.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue