Commit 9b5615d5f3f05a028d060d129c2c1ad46f05cca3

Con Kolivas 2012-04-21T17:20:33

Shut down the api cleanly when the api thread is cancelled. This should allow the api socket to be closed successfully to next be reopened with app_restart.