private void CloseInjectScriptSocketAndBecomePassthrough() { if (_injectScriptSocket != null) { _injectScriptSocket.Dispose(); _injectScriptSocket = null; } _filterState = FilterState.Passthrough; }
/// <remarks> /// This function is the pump that pushes data from the buffers into an /// HTTP connection. It asynchronously waits on data, then asynchronously /// waits while the data is sent, then waits on more data, etc. /// </remarks> private static async void SendDataFromBuffersAsync(RevolvingBuffers <byte> buffer, IHttpSocketAdapter adapter) { while (true) { ArraySegment <byte> bufferToSend = await buffer.GetBufferedDataAsync(); if (bufferToSend.Count == 0) { break; } await adapter.WriteToRequestAsync(bufferToSend.Array, bufferToSend.Offset, bufferToSend.Count); } await adapter.CompleteRequest(); adapter.Dispose(); }