mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +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() {
|
func (c *Croc) cleanup() {
|
||||||
c.cleanupTime = true
|
c.cleanupTime = true
|
||||||
time.Sleep(250 * time.Millisecond) // race condition, wait for
|
if !c.normalFinish {
|
||||||
// sending/receiving to finish
|
time.Sleep(1000 * time.Millisecond) // race condition, wait for
|
||||||
|
// sending/receiving to finish
|
||||||
|
}
|
||||||
// erase all the croc files and their possible numbers
|
// erase all the croc files and their possible numbers
|
||||||
for i := 0; i < 16; i++ {
|
for i := 0; i < 16; i++ {
|
||||||
fname := c.crocFile + "." + strconv.Itoa(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.channel.transferTime = time.Since(c.cs.channel.startTransfer)
|
||||||
c.cs.Unlock()
|
c.cs.Unlock()
|
||||||
log.Debug("leaving dialup")
|
log.Debug("leaving dialup")
|
||||||
|
c.normalFinish = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ type Croc struct {
|
||||||
// bothConnected
|
// bothConnected
|
||||||
bothConnected bool
|
bothConnected bool
|
||||||
// cleanupTime tells processes to close up
|
// cleanupTime tells processes to close up
|
||||||
cleanupTime bool
|
cleanupTime bool
|
||||||
|
normalFinish bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init will initialize the croc relay
|
// Init will initialize the croc relay
|
||||||
|
|
|
@ -32,6 +32,7 @@ func catFiles(files []string, outfile string, remove bool) error {
|
||||||
}
|
}
|
||||||
_, err = io.Copy(finished, fh)
|
_, err = io.Copy(finished, fh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fh.Close()
|
||||||
return errors.Wrap(err, "CatFiles copy: ")
|
return errors.Wrap(err, "CatFiles copy: ")
|
||||||
}
|
}
|
||||||
fh.Close()
|
fh.Close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue