fix crash when event server client disconnects unexpectedly
fix crash when event server client disconnects unexpectedly

Some functions like set_connected can cause the main thread event loop to run reentrantly. If the
event server client disconnects before the response is sent and a socket disconnect event is
dispatched the client data could be destroyed when phd2 goes to respond.

OpenPHDGuiding/phd2,EverettQuebral/phd2,EverettQuebral/phd2,EverettQuebral/phd2,olegkutkov/phd2guiding_crao,EverettQuebral/phd2,olegkutkov/phd2guiding_crao,EverettQuebral/phd2,hholi/phd2,hholi/phd2,simonct/phd2,OpenPHDGuiding/phd2,OpenPHDGuiding/phd2,olegkutkov/phd2guiding_crao,EverettQuebral/phd2,hholi/phd2,simonct/phd2,simonct/phd2,hholi/phd2,OpenPHDGuiding/phd2,OpenPHDGuiding/phd2,simonct/phd2,olegkutkov/phd2guiding_crao,hholi/phd2,olegkutkov/phd2guiding_crao,hholi/phd2,simonct/phd2,OpenPHDGuiding/phd2,simonct/phd2,olegkutkov/phd2guiding_crao