Skip to content

Commit

Permalink
fix removing ping from recs, in case slice is only contains ping
Browse files Browse the repository at this point in the history
  • Loading branch information
Termina1 committed Nov 26, 2024
1 parent c58bf2e commit 2791c98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ func (sync *Syncer) processPings(recs protocol.Records) protocol.Records {
for i, rec := range recs {
if protocol.Lit(rec) == 'P' {
body, _ := protocol.Take('P', rec)
recs = append(recs[:i], recs[i+1:]...)
if len(recs) > i+1 {
recs = append(recs[:i], recs[i+1:]...)
} else {
recs = recs[:i]
}
switch rdx.Snative(body) {
case PingVal:
sync.log.InfoCtx(sync.logCtx(context.Background()), "ping received")
Expand Down

0 comments on commit 2791c98

Please sign in to comment.