]> Cypherpunks repositories - nncp.git/commitdiff
Ability to transfer only specified packets in nncp-call
authorSergey Matveev <stargrave@stargrave.org>
Sun, 28 Apr 2019 09:35:40 +0000 (12:35 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 28 Apr 2019 09:54:37 +0000 (12:54 +0300)
doc/news.ru.texi
doc/news.texi
src/cypherpunks.ru/nncp/sp.go

index 080333a6fb3889325314700b27b3422ccee2e7dc..a17c2efa0a73405d7af8a896e43ef993b3d2a1de 100644 (file)
 Проверка доступного места перед копированием во время работы
 @command{nncp-xfer}, @command{nncp-daemon}, @command{nncp-call(er)}.
 @item
-@command{nncp-call} теперь может только показывать список пакетов на
-удалённой машине, без их передачи.
+@command{nncp-call} имеет возможность только показывать список пакетов
+на удалённой машине, без их передачи.
 @item
-@command{nncp-call} Ð¼Ð¾Ð¶ÐµÑ\82 Ñ\81каÑ\87ивать только чётко указанные пакеты.
+@command{nncp-call} Ð¸Ð¼ÐµÐµÑ\82 Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾Ñ\81Ñ\82Ñ\8c Ð¿ÐµÑ\80едавать только чётко указанные пакеты.
 @item
 Восстановлена работоспособность @option{xxrate} настройки в
 @option{calls} секции конфигурационного файла.
index 80289c468550414207fcf2ff240e6eebaff3c807..ed1bf0839333802891b7cff8d32ddae98c6dd562 100644 (file)
@@ -15,10 +15,10 @@ decrypted data to external command. Older versions are not supported.
 Available free space checking before copying in @command{nncp-xfer},
 @command{nncp-daemon}, @command{nncp-call(er)}.
 @item
-@command{nncp-call} has ability only to listen packets on remote node,
-without its transmission.
+@command{nncp-call} has ability only to list packets on remote node,
+without their transmission.
 @item
-@command{nncp-call} has ability to download only specified packets.
+@command{nncp-call} has ability to transfer only specified packets.
 @item
 Workability of @option{xxrate} preference in @option{calls}
 configuration file section.
index bcdda79f5834add00ca0a1345f92cd00c06556aa..f28251459510edd97f8df3b77c6f5b8164297ac8 100644 (file)
@@ -949,18 +949,22 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                        state.Ctx.LogD("sp-process", sdsp, "queueing")
                        nice, exists := state.infosOurSeen[*freq.Hash]
                        if exists {
-                               state.Lock()
-                               insertIdx := 0
-                               var freqWithNice *FreqWithNice
-                               for insertIdx, freqWithNice = range state.queueTheir {
-                                       if freqWithNice.nice > nice {
-                                               break
+                               if state.onlyPkts == nil || !state.onlyPkts[*freq.Hash] {
+                                       state.Lock()
+                                       insertIdx := 0
+                                       var freqWithNice *FreqWithNice
+                                       for insertIdx, freqWithNice = range state.queueTheir {
+                                               if freqWithNice.nice > nice {
+                                                       break
+                                               }
                                        }
+                                       state.queueTheir = append(state.queueTheir, nil)
+                                       copy(state.queueTheir[insertIdx+1:], state.queueTheir[insertIdx:])
+                                       state.queueTheir[insertIdx] = &FreqWithNice{&freq, nice}
+                                       state.Unlock()
+                               } else {
+                                       state.Ctx.LogD("sp-process", sdsp, "skipping")
                                }
-                               state.queueTheir = append(state.queueTheir, nil)
-                               copy(state.queueTheir[insertIdx+1:], state.queueTheir[insertIdx:])
-                               state.queueTheir[insertIdx] = &FreqWithNice{&freq, nice}
-                               state.Unlock()
                        } else {
                                state.Ctx.LogD("sp-process", sdsp, "unknown")
                        }