]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/sp.go
Bad exit code if queues are not empty
[nncp.git] / src / sp.go
index 772d92c4d729bb4fbec8ba066ae67a3438e45807..eca9544945b1e0d734d6b21d692cce85dc68f372 100644 (file)
--- 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) {