This commit upgrades the current agnerized version being used by the Makefile. This prompted changes to the rebar config. The true build problems were caused by the merge #63, which added a fix to the -include_lib path to better work with release. However, this introduced a problem when compiling with rebar given rebar calls 'erlc', which ignores all ERL_LIBS options and thus will only support the default system libs (apparently). This commit adds a macro definition to rebar.config and a preprocessor switch to the socketio_listener module (which had the include_lib changed) so that when compiled from rebar, we use the old code that worked, and when going without rebar, we use the fix that existed. Hopefully that will make everyone happy.
…king care of this now)
…emoving socket.io client code via git submodule
We fix the timer issues having to do with erlang BIF timers conflicting with the connection timeouts occurring after a closed socket. Any client whose connection is closed at the point where the 'dead connection timeout' is longer than the polling/heartbeat timer's time left will have conflicting timers where the polling/heartbeat resets the dead connection timeout. Given the delays between the 'dead connection timeout' and the regular polling/heartbeat timeout can be very close (and are set that way by default), this conflict happens fairly often. Because we are not exactly sure what makes it valid to cancel the dead connection timer, this fix makes it so both timers are handled the same way, replicating the old behaviour present before the recent fixes to the timers when it comes to these connections.
More timers and heartbeats fixed, including htmlfile and xhr multipart. Nothing in the tests seemed to have an influence on the htmlfile transport. Further tests ought to be added in time. Note that as for the other transport, the timeout on a disconnection is still not a BIF, compared to the heartbeats which now use the Erlang timer functions.
The current way of handling timeouts is risky with regards to user calls able to mess with the timeouts and get things out of sync with the client side. This fix replaces the timeouts coming from the gen_server behaviour with the erlang timer BIFs, likely safer and independent of the messages received. The timeouts having to do with a connection being closed are still handled the old way.
The current way of doing timers in websockets is fickle and bound to error when it is reset on all messages we get. Just by sending a process random messages, the timers get reset all the time. This fix adds a different way of handling timers by using the erlang module's start_timer/3 and cancel_timer/1 to get a safer timeout/heartbeat behaviour.
The current behaviour of the application when the configuration value for heartbeats (and a delay for closing files in xhr) was to silently ignore the issue and substitute it by a default value. This patch adds warning messages going through the standard error_logger in order to let the user of socket.io-erlang know something went wrong. The default heartbeat value from websockets was also changed from infinity to 10 seconds, the same as in the app file we currently have. Setting it to infinity had as a consequence that the client code would always disconnect from the protocol, without closing the websocket. This would result in a particular tab of a browser holding dozens of live websockets that can receive data (and look alive to the server) but not send any from all of them but the last one.