chiark / gitweb /
realtime: do not retransmit NMRA idle packets for nonexistent adjucts - instead,...
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 8 Jan 2011 20:37:03 +0000 (20:37 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 8 Jan 2011 20:37:03 +0000 (20:37 +0000)
hostside/actual.c
hostside/realtime.h

index ae5de8a3774a4ae65198e173d3cf6d2eb23d102c..426ab6c13fa154eb61a634be189f725a348ec97e 100644 (file)
@@ -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; ai<n_adjaddrs; ai++,ap++) {
     AdjunctsAddr *a= *ap;
-    for (ix=0; ix<ADJUNCTSADDR_TRANSMITS; ix++) {
-      RetransmitRelaxedNode *rn= &a->rn[ix];
-      if (!rn->pi.l) {
-       enco_nmra_idle(&n);
-       retransmit_relaxed_queue(rn,&n);
-      }
-    }
     adjuncts_updated(a);
   }
 }
index 1b4c63d2d148ba842ea95835eb4ed56cf4a88cbd..2affa20285c0833f88617c20149851853698b7be 100644 (file)
@@ -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;