Fix debug progressbar bug and make sure to clean enc.0

This commit is contained in:
Zack Scholl 2018-04-13 15:21:15 -07:00
parent 78df00f7ab
commit 39e2a20a6f
1 changed files with 9 additions and 3 deletions

View File

@ -124,8 +124,11 @@ func NewConnection(config *AppConfig) (*Connection, error) {
func (c *Connection) cleanup() {
log.Debug("cleaning")
for id := 1; id <= 8; id++ {
os.Remove(path.Join(c.Path, c.File.Name+".enc."+strconv.Itoa(id)))
for id := 0; id <= 8; id++ {
err := os.Remove(path.Join(c.Path, c.File.Name+".enc."+strconv.Itoa(id)))
if err == nil {
log.Debugf("removed %s", path.Join(c.Path, c.File.Name+".enc."+strconv.Itoa(id)))
}
}
os.Remove(path.Join(c.Path, c.File.Name+".enc"))
}
@ -340,7 +343,10 @@ func (c *Connection) runClient() error {
responses.Lock()
responses.startTime = time.Now()
responses.Unlock()
c.bar.Reset()
if !c.Debug {
c.bar.Reset()
}
if err := c.sendFile(id, connection); err != nil {
log.Error(err)
}