(stub, baseDelay)
| 313 | } |
| 314 | |
| 315 | function scheduleReconnect(stub, baseDelay) { |
| 316 | if (stub.closed) return; |
| 317 | baseDelay = baseDelay || 500; |
| 318 | |
| 319 | stub.retryCount = Math.min(7, stub.retryCount + 1); |
| 320 | var timeout = Math.random() * (2 ** stub.retryCount) * baseDelay; |
| 321 | stub.reconnectTimeout = setTimeout(function () { |
| 322 | stub.reconnectTimeout = null; |
| 323 | if (!stub.closed) startConnection(stub); |
| 324 | }, timeout); |
| 325 | } |
| 326 | |
| 327 | // ======================================== |
| 328 | // EVENT DISPATCH |
no test coverage detected