chiark
/
gitweb
/
~ijackson
/
trains.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c4b0295
)
abandon infinite loop in report_nextseg sooner
author
ian
<ian>
Sun, 27 Jul 2008 13:53:18 +0000
(13:53 +0000)
committer
ian
<ian>
Sun, 27 Jul 2008 13:53:18 +0000
(13:53 +0000)
hostside/safety.c
patch
|
blob
|
history
diff --git
a/hostside/safety.c
b/hostside/safety.c
index bdcdbfe35c7c6c0c4385e5b7ab6b061c72640821..bea01b3e61e40353dddf16bd4696c73ebe50a19d 100644
(file)
--- a/
hostside/safety.c
+++ b/
hostside/safety.c
@@
-1014,8
+1014,14
@@
static int report_nextseg(TrackLocation *t, struct TrackAdvanceContext *c,
char flags[6];
int r;
+ u->lookahead++;
+ if (u->lookahead > (int)(NUM_SEGMENTS * 1.5)) {
+ ouprintf(" [... infinite loop!]\n");
+ abort();
+ }
+
if (u->done_fdet) /* we've had foredetect */
- if (
++
u->lookahead > u->train->plan_lookahead_nsegs)
+ if (u->lookahead > u->train->plan_lookahead_nsegs)
return -1;
flags[0]= 0;