X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=blobdiff_plain;f=src%2Fsp.go;h=eca9544945b1e0d734d6b21d692cce85dc68f372;hp=772d92c4d729bb4fbec8ba066ae67a3438e45807;hb=2570c230757df9e463ea072d9110564b53031ce3;hpb=b46eb09ab5d2a55df479566b3758e21ff136e20e diff --git a/src/sp.go b/src/sp.go index 772d92c..eca9544 100644 --- a/src/sp.go +++ b/src/sp.go @@ -1114,7 +1114,7 @@ func (state *SPState) StartWorkers( return nil } -func (state *SPState) Wait() { +func (state *SPState) Wait() bool { state.wg.Wait() close(state.payloads) close(state.pings) @@ -1130,12 +1130,15 @@ func (state *SPState) Wait() { if txDuration > 0 { state.TxSpeed = state.TxBytes / txDuration } + nothingLeft := len(state.queueTheir) == 0 for _, s := range state.fds { + nothingLeft = false s.fd.Close() } for pktName := range state.progressBars { ProgressKill(pktName) } + return nothingLeft } func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {