ethankaminski/dragons-table — pull request #4 by dylanryan (2014-10-22 03:20:13+00:00)
Title: Clean server shutdown

HEY! LISTEN! Don't commit this until after you commit those other 2 PRs. It includes all their data because Git is crazy.

HEY! LISTEN! By informing the clients that the server shutdown and cleanly disconnecting, clients DO NOT automatically attempt to reconnect when the server comes back. I personally think this is a good idea because attempting to reconnect to a new server instance that might have already handed out your username is just asking for a world of pain. But you may not agree with that, so you may not want to add this at all.

Anyway. Add a handler to the server to catch SIGINT/^C to allow it to inform clients that it is going down cleanly. Performed minimal cleanup on clients, more could likely be done there but I'm not really sure how important it is yet. Just disconnecting the server does a lot of good.