]> Cypherpunks.ru repositories - nncp.git/commitdiff
Single background SP worker is allowed
authorSergey Matveev <stargrave@stargrave.org>
Sat, 18 Nov 2017 14:12:57 +0000 (17:12 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 18 Nov 2017 20:34:17 +0000 (23:34 +0300)
VERSION
doc/news.ru.texi
doc/news.texi
src/cypherpunks.ru/nncp/sp.go

diff --git a/VERSION b/VERSION
index c43e1055fd3f2e00540c298404934e8097459098..f3040840fd7058ec0e224314c609184fd4ec53f2 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.12
+0.13
index 98804fb87c014fde77431e6174b5445d45d7910d..5c5ee0d135eae55630cc2ea1429f2098deaa5dc7 100644 (file)
@@ -1,6 +1,15 @@
 @node Новости
 @section Новости
 
+@node Релиз 0.13
+@subsection Релиз 0.13
+@itemize
+@item
+В команде @command{nncp-call} разрешается иметь только одного
+обработчика контрольной суммы в фоне. Это полезно когда тысячи маленьких
+входящих пакетов могут создать много горутин.
+@end itemize
+
 @node Релиз 0.12
 @subsection Релиз 0.12
 @itemize
index 8f36b4b590be2b2faa0a1a51b8911be68d189307..d673d807537ffc7202b3376bb7214f5c8c83da75 100644 (file)
@@ -3,6 +3,15 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 0.13
+@section Release 0.13
+@itemize
+@item
+Single background checksum verifier worker is allowed in
+@command{nncp-call}. This is helpful when thousands of small inbound
+packets could create many goroutines.
+@end itemize
+
 @node Release 0.12
 @section Release 0.12
 @itemize
index be845109752a79b2393dfdb8be20b716c5584621..6daab72c643c4eb3f7df571c0c205da48abdf74d 100644 (file)
@@ -55,6 +55,8 @@ var (
                noise.CipherChaChaPoly,
                noise.HashBLAKE2b,
        )
+
+       spWorkersGroup sync.WaitGroup
 )
 
 type SPType uint8
@@ -838,6 +840,8 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                                continue
                        }
                        state.RUnlock()
+                       spWorkersGroup.Wait()
+                       spWorkersGroup.Add(1)
                        go func() {
                                if err := fd.Sync(); err != nil {
                                        state.ctx.LogE("sp-file", SdsAdd(sdsp, SDS{"err": err}), "sync")
@@ -859,6 +863,7 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                                state.Lock()
                                delete(state.infosTheir, *file.Hash)
                                state.Unlock()
+                               spWorkersGroup.Done()
                                go func() {
                                        state.payloads <- MarshalSP(SPTypeDone, SPDone{file.Hash})
                                }()