/// <summary> /// Returns the response context to the pool. /// </summary> /// <param name="context">The response to the pool.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="context"/> is <c>null</c>. /// </exception> protected internal void ReturnResponseContext(ClientResponseContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } Contract.EndContractBlock(); context.Clear(); context.UnboundTransport(); ResponseContextPool.Return(context); }
internal bool DumpCorrupttedData(ClientResponseContext context) { if (context.BytesTransferred == 0) { context.Clear(); return(false); } if (Manager.Configuration.DumpCorruptResponse) { using var dumpStream = OpenDumpStream(context.SessionStartedAt, context.RemoteEndPoint, context.SessionId, MessageType.Response, context.MessageId); dumpStream.Write(context.CurrentReceivingBuffer, context.CurrentReceivingBufferOffset, context.BytesTransferred); dumpStream.Flush(); } context.ShiftCurrentReceivingBuffer(); return(true); }