internal void UnblockTraffic(IPEndPoint localServerEndpoint, StackTransportType transportType) { if (disposed) { return; } String strKey = null; foreach (KeyValuePair <string, LspSessionInfoCollection> kvp in sessionMap) { //sessionMap key is local listening endpoint //sessionMap value is remote intertecpted endpoint if (kvp.Value.lspSession.InterceptedEndPoint.protocolType == transportType && kvp.Value.lspSession.InterceptedEndPoint.endPoint.Equals(localServerEndpoint)) { LspSession session = kvp.Value.lspSession; if (!isConnected) { Connect(); } LspUnblockRequest request = new LspUnblockRequest(session); InternalSend(request.Encode()); byte[] recvBuf; int recvLen = LspMessage.ReceiveWholeMessage(this.socket, Marshal.SizeOf(typeof(LspUnblockResponseMsg)), out recvBuf); if (recvLen != Marshal.SizeOf(typeof(LspUnblockResponseMsg))) { throw new InvalidOperationException("UnBlockTraffic failed"); } LspUnblockResponse response = LspUnblockResponse.Decode(recvBuf) as LspUnblockResponse; strKey = kvp.Key; if (response == null || response.Status != 0) { throw new InvalidOperationException("UnBlockTraffic failed"); } break; } } //remove it from session map if (strKey != null) { sessionMap.Remove(strKey); } }
internal void UnblockTraffic(IPEndPoint localServerEndpoint, StackTransportType transportType) { if (disposed) { return; } String strKey = null; foreach (KeyValuePair<string, LspSessionInfoCollection> kvp in sessionMap) { //sessionMap key is local listening endpoint //sessionMap value is remote intertecpted endpoint if(kvp.Value.lspSession.InterceptedEndPoint.protocolType == transportType && kvp.Value.lspSession.InterceptedEndPoint.endPoint.Equals(localServerEndpoint)) { LspSession session = kvp.Value.lspSession; if (!isConnected) { Connect(); } LspUnblockRequest request = new LspUnblockRequest(session); InternalSend(request.Encode()); byte[] recvBuf; int recvLen = LspMessage.ReceiveWholeMessage(this.socket, Marshal.SizeOf(typeof(LspUnblockResponseMsg)), out recvBuf); if (recvLen != Marshal.SizeOf(typeof(LspUnblockResponseMsg))) { throw new InvalidOperationException("UnBlockTraffic failed"); } LspUnblockResponse response = LspUnblockResponse.Decode(recvBuf) as LspUnblockResponse; strKey = kvp.Key; if (response == null || response.Status != 0) { throw new InvalidOperationException("UnBlockTraffic failed"); } break; } } //remove it from session map if (strKey != null) { sessionMap.Remove(strKey); } }