Implemented inner shutdown handler callback
Implemented inner shutdown handler callback

The server now periodically runs a callback to check if the thread has
stopped. If the thread has been stopped, it closes the client
connections and stops the server process. This prevents the
`DataThread` from hanging on shutdown.

VT-SailBOT/sailbot,VT-SailBOT/sailbot