progressBarsLock.Unlock()
}
}
+
+func ProgressKill(pkt string) {
+ progressBarsLock.Lock()
+ pb, exists := progressBars[pkt]
+ if exists {
+ pb.Kill()
+ delete(progressBars, pkt)
+ }
+ progressBarsLock.Unlock()
+}
fdsLock sync.RWMutex
fileHashers map[string]*HasherAndOffset
checkerQueues SPCheckerQueues
+ progressBars map[string]struct{}
sync.RWMutex
}
state.pings = make(chan struct{})
state.infosTheir = make(map[[32]byte]*SPInfo)
state.infosOurSeen = make(map[[32]byte]uint8)
+ state.progressBars = make(map[string]struct{})
state.started = started
state.rxLock = rxLock
state.txLock = txLock
state.pings = make(chan struct{})
state.infosOurSeen = make(map[[32]byte]uint8)
state.infosTheir = make(map[[32]byte]*SPInfo)
+ state.progressBars = make(map[string]struct{})
state.started = started
state.xxOnly = xxOnly
LE{"FullSize", fullSize},
)
if state.Ctx.ShowPrgrs {
+ state.progressBars[pktName] = struct{}{}
Progress("Tx", lesp)
}
state.Lock()
} else {
state.queueTheir = state.queueTheir[:0]
}
+ if state.Ctx.ShowPrgrs {
+ delete(state.progressBars, pktName)
+ }
} else {
state.queueTheir[0].freq.Offset += uint64(len(buf))
}
if txDuration > 0 {
state.TxSpeed = state.TxBytes / txDuration
}
+ for pktName := range state.progressBars {
+ ProgressKill(pktName)
+ }
}
func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
}
lesp = append(lesp, LE{"FullSize", fullsize})
if state.Ctx.ShowPrgrs {
+ state.progressBars[pktName] = struct{}{}
Progress("Rx", lesp)
}
if fullsize != ourSize {
continue
}
+ if state.Ctx.ShowPrgrs {
+ delete(state.progressBars, pktName)
+ }
logMsg = func(les LEs) string {
return fmt.Sprintf(
"Got packet %s %d%% (%s / %s)",