]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/sp.go
Fix RxLastNonPing setting
[nncp.git] / src / sp.go
index aca6f18c1824caf6d5908609b88c22841cb29c59..37cf265ead11ac3588fcb66eab69f7641599cc9c 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -851,6 +851,9 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                        state.Ctx.LogE("sp-process", sds, err, "")
                        return nil, err
                }
+               if head.Type != SPTypePing {
+                       state.RxLastNonPing = state.RxLastSeen
+               }
                switch head.Type {
                case SPTypeHalt:
                        state.Ctx.LogD("sp-process", SdsAdd(sds, SDS{"type": "halt"}), "")
@@ -1086,9 +1089,6 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                        )
                        return nil, BadPktType
                }
-               if head.Type != SPTypePing {
-                       state.RxLastNonPing = state.RxLastSeen
-               }
        }
        if infosGot {
                var pkts int