}
}
progressBarsLock.RLock()
- pb, exists := progressBars[pkt]
+ pb := progressBars[pkt]
progressBarsLock.RUnlock()
- if !exists {
+ if pb == nil {
progressBarsLock.Lock()
pb = ProgressBarNew(size, fullsize)
progressBars[pkt] = pb
func ProgressKill(pkt string) {
progressBarsLock.Lock()
- pb, exists := progressBars[pkt]
- if exists {
+ pb := progressBars[pkt]
+ if pb != nil {
pb.Kill()
delete(progressBars, pkt)
}
}
fullsize := int64(0)
state.RLock()
- infoTheir, ok := state.infosTheir[*file.Hash]
+ infoTheir := state.infosTheir[*file.Hash]
state.RUnlock()
- if !ok {
+ if infoTheir == nil {
state.Ctx.LogE("sp-file-open", lesp, err, func(les LEs) string {
return logMsg(les) + ": unknown file"
})
}
argsStr := strings.Join(append([]string{handle}, args...), " ")
les = append(les, LE{"Type", "exec"}, LE{"Dst", argsStr})
- cmdline, exists := sender.Exec[handle]
- if !exists || len(cmdline) == 0 {
+ cmdline := sender.Exec[handle]
+ if len(cmdline) == 0 {
err = errors.New("No handle found")
ctx.LogE(
"rx-no-handle", les, err,
return err
}
if len(sendmail) > 0 && ctx.NotifyExec != nil {
- notify, exists := ctx.NotifyExec[sender.Name+"."+handle]
- if !exists {
- notify, exists = ctx.NotifyExec["*."+handle]
+ notify := ctx.NotifyExec[sender.Name+"."+handle]
+ if notify == nil {
+ notify = ctx.NotifyExec["*."+handle]
}
- if exists {
+ if notify != nil {
cmd := exec.Command(
sendmail[0],
append(sendmail[1:], notify.To)...,