From 23c9b456398783ed0453bc67edbfee45fd1ddeb8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 8 Jan 2011 20:37:03 +0000 Subject: [PATCH] realtime: do not retransmit NMRA idle packets for nonexistent adjucts - instead, transmit nothing at all --- hostside/actual.c | 15 ++++----------- hostside/realtime.h | 3 ++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/hostside/actual.c b/hostside/actual.c index ae5de8a..426ab6c 100644 --- a/hostside/actual.c +++ b/hostside/actual.c @@ -55,9 +55,10 @@ void actual_inversions_done(void) { /*---------- adjucts ----------*/ static void adj_updated_cmd(AdjunctsAddr *a, int ix, Nmra *n /*destroyed*/) { - assert(a->rn[ix].pi.l); - retransmit_relaxed_cancel(&a->rn[ix]); + if (a->rn[ix].pi.l) + retransmit_relaxed_cancel(&a->rn[ix]); retransmit_relaxed_queue(&a->rn[ix], n); + assert(a->rn[ix].pi.l); } static void adj_updated_funcs(AdjunctsAddr *a, int ix, @@ -88,18 +89,10 @@ void adjuncts_updated(AdjunctsAddr *a) { void adjuncts_start_xmit(void) { AdjunctsAddr **ap; - Nmra n; - int ix, ai; + int ai; for (ai=0,ap=adjaddrs; airn[ix]; - if (!rn->pi.l) { - enco_nmra_idle(&n); - retransmit_relaxed_queue(rn,&n); - } - } adjuncts_updated(a); } } diff --git a/hostside/realtime.h b/hostside/realtime.h index 1b4c63d..2affa20 100644 --- a/hostside/realtime.h +++ b/hostside/realtime.h @@ -36,7 +36,8 @@ typedef unsigned Retransmit__Time; * retransmit.c only; as a special exception, caller may edit pi * directly. Normally, though, pi is set by supplying an NMRA * command to one of the _queue functions; iff the Nmra* is - * non-null, _queue will add an NMRA checksum and update pi. + * non-null, _queue will add an NMRA checksum (modifying *n) + * and update pi (which always results in a nonzero pi.l). */ struct RetransmitRelaxedNode { PicInsn pi; -- 2.30.2