]> Cypherpunks.ru repositories - nncp.git/commitdiff
Wait for background checksummers completion
authorSergey Matveev <stargrave@stargrave.org>
Sat, 26 Jun 2021 12:12:53 +0000 (15:12 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 26 Jun 2021 12:12:53 +0000 (15:12 +0300)
doc/news.ru.texi
doc/news.texi
src/nncp.go
src/sp.go

index 69e3201022834fb13d0ed0bd99199ffce390d1fb..fc18fd5665cf87fd43a07d194a39caa4e0536110 100644 (file)
@@ -1,6 +1,17 @@
 @node Новости
 @section Новости
 
+@node Релиз 6.6.0
+@subsection Релиз 6.6.0
+@itemize
+
+@item
+@command{nncp-daemon}, @command{nncp-call} и @command{nncp-caller}
+ожидают завершения всех процессов фоновой проверки контрольных сумм,
+после того как соединение закрыто.
+
+@end itemize
+
 @node Релиз 6.5.0
 @subsection Релиз 6.5.0
 @itemize
@@ -18,7 +29,7 @@
 
 @item
 Убирать показ прогресса передачи пакетов когда вызов уже завершён в
-@command{nncp-daemon}, @command{nncp-call} and @command{nncp-caller}.
+@command{nncp-daemon}, @command{nncp-call} и @command{nncp-caller}.
 
 @end itemize
 
index 6fcf7337054ea605b8d988e6d70732a06d68e9fd..d0ef49ec3f9ea6e06f98d14520c8b2caeafe53ae 100644 (file)
@@ -3,6 +3,17 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 6.6.0
+@section Release 6.6.0
+@itemize
+
+@item
+@command{nncp-daemon}, @command{nncp-call} and @command{nncp-caller}
+commands wait for all background checksummers completion after
+connection is finished.
+
+@end itemize
+
 @node Release 6.5.0
 @section Release 6.5.0
 @itemize
index a9af93cacba68392ca0e7d1a426da10eaf2fa73d..1dfdb7497142d5c698b77f2f7c377cd3b9cc71fb 100644 (file)
@@ -40,7 +40,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 const Base32Encoded32Len = 52
 
 var (
-       Version string = "6.5.0"
+       Version string = "6.6.0"
 
        Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
 )
index 0b039e6bffb9f80f6eecff80b36d8ce985552215..00eaac6b50d58ee0dc8665fa04d2a0a54b6c913b 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -65,7 +65,8 @@ var (
        DefaultDeadline = 10 * time.Second
        PingTimeout     = time.Minute
 
-       spCheckers = make(map[NodeId]*SPCheckerQueues)
+       spCheckers   = make(map[NodeId]*SPCheckerQueues)
+       SPCheckersWg sync.WaitGroup
 )
 
 type FdAndFullSize struct {
@@ -282,6 +283,7 @@ func SPChecker(ctx *Ctx, nodeId *NodeId, appeared, checked chan *[32]byte) {
                        {"Node", nodeId},
                        {"Pkt", pktName},
                }
+               SPCheckersWg.Add(1)
                ctx.LogD("sp-checker", les, func(les LEs) string {
                        return fmt.Sprintf("Checksumming %s/rx/%s", ctx.NodeName(nodeId), pktName)
                })
@@ -302,6 +304,7 @@ func SPChecker(ctx *Ctx, nodeId *NodeId, appeared, checked chan *[32]byte) {
                                pktName, humanize.IBytes(uint64(size)),
                        )
                })
+               SPCheckersWg.Done()
                go func(hsh *[32]byte) { checked <- hsh }(hshValue)
        }
 }
@@ -1135,8 +1138,9 @@ func (state *SPState) Wait() {
        state.wg.Wait()
        close(state.payloads)
        close(state.pings)
-       state.dirUnlock()
        state.Duration = time.Now().Sub(state.started)
+       SPCheckersWg.Wait()
+       state.dirUnlock()
        state.RxSpeed = state.RxBytes
        state.TxSpeed = state.TxBytes
        rxDuration := int64(state.RxLastSeen.Sub(state.started).Seconds())