chiark / gitweb /
realtime: resolve: do not mess improperly with tr_backwards
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 19 Jan 2011 23:10:29 +0000 (23:10 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Wed, 19 Jan 2011 23:22:47 +0000 (23:22 +0000)
commit67ec4ac2180ec1236ba5ed617fc87cd9f106adb2
tree74631d99897ffb1c5c1f615f4a6869decf1406a2
parent8e8f8d29ac4ca5ed0adc80eeb6f346fefb904d56
realtime: resolve: do not mess improperly with tr_backwards

Previously we would attempt to sort out Segment.tr_backwards in
resmain_getmovpos.  This is wrong because *_getmovpos shouldn't have
that kind of side-effect.

Furthermore the actual code was wrong: it wasn't idempotent: the
number of times tr_backwards would be inverted for a backwards train
would depend on how many times resmain_getmovpos was called.

Actually, for backwards trains not resolving at home, there is no need
to mess with tr_backwards.  The existing tr_backwards for the segments
it owns is fine.  For trains resolving at home, we need to explicitly
clear the train's direction too, and we should do this in a dedicated
piece of code.

Fixes:
@2011-01-10 20:28:23 GMT info save-dump +dump.2011-01-10T20-28-23+0000
traversed santafe forwards from B8 to B7 when B7/J1
hostside/TODO
hostside/resolve.c