private void doOnConnected(int heartbeat, int connectionID, CometClientTransportWrapper transport) { if (refreshState != null) { if (transport == refreshTransport) { if (refreshState == RefreshState.PRIMARY_DISCONNECTED) { doneRefresh(); } else if (refreshState == RefreshState.CONNECTING) { primaryTransport.disconnect(); doneRefresh(); } else { throw new IllegalStateException("Unexpected refresh state"); } } else { // refreshed connection after connection failed if (refreshState != RefreshState.CONNECTING && refreshState != RefreshState.PRIMARY_RECONNECT) { throw new IllegalStateException("Unexpected refresh state"); } refreshState = null; listener.onAfterRefresh(); } } else { listener.onConnected(heartbeat, connectionID); } }
private void doOnConnected(int heartbeat, int connectionID, CometClientTransportWrapper transport) { if (refreshState != null) { if (transport == refreshTransport) { if (refreshState == RefreshState.PRIMARY_DISCONNECTED) { doneRefresh(); } else if (refreshState == RefreshState.CONNECTING) { primaryTransport.disconnect(); doneRefresh(); } else { throw new IllegalStateException("Unexpected refresh state"); } } else { // refreshed connection after connection failed if (refreshState != RefreshState.CONNECTING && refreshState != RefreshState.PRIMARY_RECONNECT) { throw new IllegalStateException("Unexpected refresh state"); } refreshState = null; listener.onAfterRefresh(); } } else { listener.onConnected(heartbeat, connectionID); } }
private void doOnError(Throwable exception, boolean connected, CometClientTransportWrapper transport) { if (connected) { transport.disconnect(); } listener.onError(exception, connected); }
private void doOnError(Throwable exception, boolean connected, CometClientTransportWrapper transport) { if (connected) { transport.disconnect(); } listener.onError(exception, connected); }
private void doDisconnect() { refreshState = null; primaryTransport.disconnect(); if (refreshTransport != null) { refreshTransport.disconnect(); } }
private void doDisconnect() { refreshState = null; primaryTransport.disconnect(); if (refreshTransport != null) { refreshTransport.disconnect(); } }