internal void ChangeToBlockingMode(IPEndPoint localServerEndpoint, StackTransportType transportType) { if (disposed) { return; } if (!isConnected) { Connect(); } 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; LspBlockRequest request = new LspBlockRequest(session); InternalSend(request.Encode()); byte[] recvBuf; int recvLen = LspMessage.ReceiveWholeMessage(this.socket, Marshal.SizeOf(typeof(LspBlockResponseMsg)), out recvBuf); if (recvLen != Marshal.SizeOf(typeof(LspBlockResponseMsg))) { throw new InvalidOperationException("BlockTraffic failed"); } LspBlockResponse response = LspBlockResponse.Decode(recvBuf) as LspBlockResponse; if (response == null || response.Status != 0) { throw new InvalidOperationException("BlockTraffic failed"); } return; } } throw new InvalidOperationException("The specified endpoint isn't in intercepted mode"); }
internal void ChangeToBlockingMode(IPEndPoint localServerEndpoint, StackTransportType transportType) { if (disposed) { return; } if (!isConnected) { Connect(); } 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; LspBlockRequest request = new LspBlockRequest(session); InternalSend(request.Encode()); byte[] recvBuf; int recvLen = LspMessage.ReceiveWholeMessage(this.socket, Marshal.SizeOf(typeof(LspBlockResponseMsg)), out recvBuf); if (recvLen != Marshal.SizeOf(typeof(LspBlockResponseMsg))) { throw new InvalidOperationException("BlockTraffic failed"); } LspBlockResponse response = LspBlockResponse.Decode(recvBuf) as LspBlockResponse; if (response == null || response.Status != 0) { throw new InvalidOperationException("BlockTraffic failed"); } return; } } throw new InvalidOperationException("The specified endpoint isn't in intercepted mode"); }