chiark / gitweb /
spot loopbacks; better death recursion discovery
authorian <ian>
Sun, 18 May 2008 19:03:21 +0000 (19:03 +0000)
committerian <ian>
Sun, 18 May 2008 19:03:21 +0000 (19:03 +0000)
hostside/realtime.c
hostside/startup.c

index 8b246c855be3d5ac2cfa1428e23cc7fa08bf5367..1dd2f418172ba15eb34533cd25ecf398e70d7253 100644 (file)
@@ -202,7 +202,10 @@ void ouhexi(const char *word, const Byte *command, int length) {
 }
  
 void die_vprintf_hook(const char *fmt, va_list al) {
-  if (events) { events=0; ovprintf(UPO, fmt, al); }
+  static int recursing;
+  if (!recursing++)
+    ovprintf(UPO, fmt, al);
+  recursing--;
 }
  
 void die_hook(void) {
index 275941c623b52e26190ed648ad1aa60b2100c98b..db87def5d30a1afe1ed7dc2dd3447e1860006fd0 100644 (file)
@@ -246,8 +246,11 @@ void on_pic_pong(const PicInsnInfo *pii, const PicInsn *pi, int objnum) {
   if (sta_state == Sta_Manual)
     return;
 
-  if (objnum != pong_seq)
-    die("PIC sent wrong ping response (0x%x, wanted 0x%x)", objnum, pong_seq);
+  if (objnum != pong_seq) {
+    if (objnum == (pong_seq^PING_PONG_PATTERN))
+      die("PIC connection is looped back (ping %#05x bounced)", objnum);
+    die("PIC sent wrong ping response (%#05x, wanted %#05x)", objnum, pong_seq);
+  }
 
   ping_toev.duration= 1000;
   ping_toev.callback= timefor_ping;