Do not send libwecksockets to sleep on the main thread
Besides some cleanup of obsolete code, and an unnecessary static function which confused me: I think libwebsockets was not used correctly. It supported a timeout at some point, but now it expects to use an event library like libuv or libev, or one should run lws_service in a separate thread and handle everything in the callbacks. JAliEn-ROOT just runs lws_service in the main thread, and then sleeps for a random amount of time until the operating system sends a signal, or something happens on a socket. Different behavior from different versions of libwebsockets / CMake options was basically only since the changed some internal unrelated behavior, and the OS would wake up the thread more or less often. This patch adds a cancel event, if the connection is already established, to avoid the waiting when checking if the connection has died, which solves all the delays for me. I put it only for libwebsockets >= 4.0, didn't check exactly when this API was introduced. Perhaps it is also needed for some of the later 3.x releases, but anyway, we should bump to a reasonable version. 3.0.1 we use right now is from 2018.