]> Cypherpunks.ru repositories - nncp.git/commitdiff
Do not close fd each time chunk is sent
authorSergey Matveev <stargrave@stargrave.org>
Fri, 9 Jul 2021 11:40:09 +0000 (14:40 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 9 Jul 2021 12:19:43 +0000 (15:19 +0300)
src/sp.go

index 84d74bbc4ab629def551545511557ab54183b5eb..5840bd15c794b7586a26098d6c4cdc750a9d0f7c 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -932,8 +932,9 @@ func (state *SPState) StartWorkers(
                                                        logMsg(les), humanize.IBytes(uint64(n)),
                                                )
                                        })
+                               } else {
+                                       state.closeFd(pth)
                                }
-                               state.closeFd(pth)
                                payload = MarshalSP(SPTypeFile, SPFile{
                                        Hash:    freq.Hash,
                                        Offset:  freq.Offset,