I see a graceful_shutdown() function in nwamd that is supposed to take care of the disabling of nwam. signal handler for SIGTERM and SIGQUIT call the graceful_shutdown() method. I also noticed that main.c:452 make an explicit call to graceful_shutdown(). This actually causes graceful_shutdown() to be called twice. :-/. What's going on here?
Now, reverting to the Legacy location: At first glance, reverting to Legacy location means enabling the Legacy location (also mentioned in the comments in nwamd_loc_revert_to_legacy()). But this doesn't work. Because enabling locations is done by placing an event in the event queue, the event is never run as nwamd quits. Thus, the solution I propose is to explicitly set the location/selected property of network/location in network/physical:nwam's stop method. Then refresh network/location. network/location will check if the location/selected is Legacy, and if so, will undo the effects of create_legacy_loc(). Anurag
