public static bool isValidforPack(SessionPack sessionPack) { if (!LongConnector.isAvailable()) { sessionPack.mConnectMode = 2; sessionPack.mCacheBodyBuffer = null; } int mConnectMode = sessionPack.mConnectMode; if (mConnectMode == 1) { return(LongConnector.isValid()); } if (mConnectMode != 2) { return(false); } if (string.IsNullOrEmpty(sessionPack.mCmdUri)) { Log.e("Network", "Cannot send pack via http without uri, will been cancelled. seq= " + sessionPack.mSeqID); sessionPack.mCanceled = true; return(false); } return(ShortConnector.isValid()); }
private static void checkNeedKeepAliveInShortConn(double interval) {//NetworkDeviceWatcher.isNetworkAvailable() && if ((!LongConnector.isAvailable()) && ShortConnector.isValid()) { double num = Util.getNowMilliseconds(); if (mLastShortKeepAliveTimestamp == 0.0) { mLastShortKeepAliveTimestamp = num; } if (num >= (mLastShortKeepAliveTimestamp + interval)) { Log.i("Network", "need keep alive in short connnector mode, post event to sync."); EventCenter.postEvent(EventConst.ON_NETSCENE_NOTIFY_SYNC_REQ, null, null); mLastShortKeepAliveTimestamp = num; } } }
private static void checkConnectStatus() { //if (!NetworkDeviceWatcher.isNetworkAvailable()) //{ // setConnectorStatus(ConntectorStatus.Disconnect); //} //else if (!LongConnector.isAvailable() || (mConnectorStatus == ConntectorStatus.Disconnect)) { if (ShortConnector.isAvailable()) { setConnectorStatus(ConntectorStatus.Connected); } else { setConnectorStatus(ConntectorStatus.Disconnect); } } }