jalbrant.com
Flight continuation and state resets
In the current beta version of [AAVOnline] I tried to see how well the program could pick up its flight status state after a flight continuation. The logic was there, I had tested it and it had appeared to work when I first wrote it, but unfortunatly did not work when I tested it in a real situation. So, of course, I set out to see if I could fix it. Here is what I found:
When the "Start Flight" button is clicked the program grabs some information from the user then procedes to login to the server, the server then replies back and gets the flight setup or replies with "duplicate" meaning they're already logged in. The gui then takes that displays a message to the user asking if they want to continue or not. If they wish to continue the server send all the info needed to communicate with it with the existing flight and the client loads its previous state from the hard disk. In theory this was supposed to work and it actually did work, except for one problem: Once a login (new flight or continued flight) is performed the gui calls a method in the middle tier that makes the program go online (fires off threads, sets up memory, etc) One of the actions this method takes is to start up the status checking thread which in turn resets its state which is where the flight report data is generated. So the state is being loaded correctly but then reset once the program tries to go online.
To fix this I simply added a flag signifying whether or not the flight was continued which tells the next call to start up the thread NOT to reset the state. Voila, it should work and I would test it but I'm in the middle of a flight at home that I don't want to lose on [AAVOnline]. (My computer's hibernated, but I'll install this version to do my test before I resume)