]> Cypherpunks.ru repositories - nncp.git/commitdiff
Fix files closing race when call is finished
authorSergey Matveev <stargrave@stargrave.org>
Sun, 30 May 2021 16:04:29 +0000 (19:04 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 30 May 2021 16:25:07 +0000 (19:25 +0300)
doc/news.ru.texi
doc/news.texi
src/sp.go

index e3087b218fb2aaa9e42a1b428676f1a0cbd3efab..69e3201022834fb13d0ed0bd99199ffce390d1fb 100644 (file)
 @item
 Исправлено возможное игнорирование плохого кода возврата автоматического tosser.
 
+@item
+Исправлена гонка при закрытии файловых дескрипторов во время завершения
+работы online протокола, которая могла привести к ошибке записи
+принятого фрагмента пакета.
+
 @item
 Убирать показ прогресса передачи пакетов когда вызов уже завершён в
 @command{nncp-daemon}, @command{nncp-call} and @command{nncp-caller}.
index 3097a0c98064b7fb3652a8a44a314b7266c2c266..6fcf7337054ea605b8d988e6d70732a06d68e9fd 100644 (file)
@@ -13,6 +13,10 @@ Fixed segfault in @command{nncp-daemon} when SP handshake did not succeed.
 @item
 Fixed possible bad return code ignoring in automatic tosser.
 
+@item
+Fixed race during file descriptors closing when online protocol call is
+finished, that could lead to write error of received packet fragment.
+
 @item
 Kill all packet transmission progress bars in @command{nncp-daemon},
 @command{nncp-call} and @command{nncp-caller} when call is finished.
index 2dde928eaeecff5a84841cb0d8889a1a8306793c..0b039e6bffb9f80f6eecff80b36d8ce985552215 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -258,11 +258,6 @@ func (state *SPState) SetDead() {
                for range state.pings {
                }
        }()
-       go func() {
-               for _, s := range state.fds {
-                       s.fd.Close()
-               }
-       }()
 }
 
 func (state *SPState) NotAlive() bool {
@@ -1152,6 +1147,9 @@ func (state *SPState) Wait() {
        if txDuration > 0 {
                state.TxSpeed = state.TxBytes / txDuration
        }
+       for _, s := range state.fds {
+               s.fd.Close()
+       }
        for pktName := range state.progressBars {
                ProgressKill(pktName)
        }