LearnBoost/socket.io-client — pull request #354 by vedratna (2011-12-21 06:08:25+00:00)
Title: fix for broken setCloseTimeout and 'IE+xhr-polling' goes into infinite loop on network disconnection

1) broken setCloseTimeout : setCloseTimeout is broke in this commit https://github.com/LearnBoost/socket.io-client/commit/172db2035fe10c52e94e5e77054ba0e82f0f7066#lib/transport.js. as all three flags are part of socket.js, it remains undefined all the time so setCloseTimeout never happens, it never dispatch disconnect on timeout and hence no reconnection until it gest error or disconnection from server or browser (like on disabling internet connection, safari on Mac does that)

2) 'IE+xhr-polling' infinite loop : To experience this, put cosole.log inside Transport.prototype.onData. Make socket.io connection on IE with Xhr-polling (you can do it by disabling flashsocket or enabling only xhr-polling). Now disable your internet connection, you can see console flooded with log and cpu usage 100%. Issue is onerror and onload has a same listener onload which is making recursive call of same function. So in case of error it calls the onload, which does 'self.get' (recursive call to same function), again error, again self.get and so on.