private static bool HandleRobustConnectionCallback(int flags, WSManClientSessionTransportManager sessionTM) { if (flags != (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_SHELL_AUTODISCONNECTED && flags != (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_NETWORK_FAILURE_DETECTED && flags != (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_RETRYING_AFTER_NETWORK_FAILURE && flags != (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_RECONNECTED_AFTER_NETWORK_FAILURE && flags != (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_SHELL_AUTODISCONNECTING && flags != (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_RETRY_ABORTED_DUE_TO_INTERNAL_ERROR) { return false; } // Raise transport event notifying start of robust connections. if (flags == (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_NETWORK_FAILURE_DETECTED) { try { sessionTM.RobustConnectionsInitiated.SafeInvoke(sessionTM, EventArgs.Empty); } catch (ObjectDisposedException) { } } // Send robust notification to client. sessionTM.QueueRobustConnectionNotification(flags); // Raise transport event notifying completion of robust connections. if (flags == (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_SHELL_AUTODISCONNECTED || flags == (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_RECONNECTED_AFTER_NETWORK_FAILURE || flags == (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_RETRY_ABORTED_DUE_TO_INTERNAL_ERROR) { try { sessionTM.RobustConnectionsCompleted.SafeInvoke(sessionTM, EventArgs.Empty); } catch (ObjectDisposedException) { } } return true; }
private static bool HandleRobustConnectionCallback(int flags, WSManClientSessionTransportManager sessionTM) { if ((((flags != 0x40) && (flags != 0x100)) && ((flags != 0x200) && (flags != 0x400))) && ((flags != 0x800) && (flags != 0x1000))) { return false; } if (flags == 0x100) { try { sessionTM.RobustConnectionsInitiated.SafeInvoke<EventArgs>(sessionTM, EventArgs.Empty); } catch (ObjectDisposedException) { } } sessionTM.QueueRobustConnectionNotification(flags); if (((flags == 0x40) || (flags == 0x400)) || (flags == 0x1000)) { try { sessionTM.RobustConnectionsCompleted.SafeInvoke<EventArgs>(sessionTM, EventArgs.Empty); } catch (ObjectDisposedException) { } } return true; }