protected override void OnReply(Message message, TimeSpan timeout) { TimeoutHelper helper = new TimeoutHelper(timeout); Message message2 = null; message2 = message; try { bool flag = this.PrepareReply(ref message2); ThreadTrace.Trace("Begin sending http reply"); this.httpOutput.Send(helper.RemainingTime()); if (TD.MessageSentByTransportIsEnabled()) { TD.MessageSentByTransport(this.Listener.Uri.AbsoluteUri); } ThreadTrace.Trace("End sending http reply"); if (flag) { this.httpOutput.Close(); } } finally { if ((message != null) && !object.ReferenceEquals(message, message2)) { message2.Close(); } } }
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, AsyncCallback callback, object state) { ThreadTrace.Trace("BC:BeginWrite"); TimeoutHelper helper = new TimeoutHelper(timeout); this.Flush(helper.RemainingTime()); return(base.BeginWrite(buffer, offset, size, immediate, helper.RemainingTime(), callback, state)); }
void FlushCore(TimeSpan timeout) { if (pendingWriteSize > 0) { ThreadTrace.Trace("BC:Flush"); Connection.Write(writeBuffer, 0, pendingWriteSize, false, timeout); pendingWriteSize = 0; } }
private void FlushCore(TimeSpan timeout) { if (this.pendingWriteSize > 0) { ThreadTrace.Trace("BC:Flush"); base.Connection.Write(this.writeBuffer, 0, this.pendingWriteSize, false, timeout); this.pendingWriteSize = 0; } }
protected virtual void SendReplyCore(Message message, TimeSpan timeout) { this.TraceProcessResponseStart(); ThreadTrace.Trace("Begin sending http reply"); HttpOutput httpOutput = this.GetHttpOutput(message); httpOutput.Send(timeout); ThreadTrace.Trace("End sending http reply"); this.TraceProcessResponseStop(); }
public ReplyAsyncResult(HttpRequestContext context, Message message, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.context = context; this.message = message; this.responseMessage = null; this.timeoutHelper = new TimeoutHelper(timeout); ThreadTrace.Trace("Begin sending http reply"); this.responseMessage = this.message; if (this.SendResponse()) { base.Complete(true); } }
void OnMessageDequeued() { ThreadTrace.Trace("message dequeued"); IAsyncResult result = this.BeginGetContext(false); if (result != null && result.CompletedSynchronously) { if (onCompleteGetContextLater == null) { onCompleteGetContextLater = new Action <object>(OnCompleteGetContextLater); } ActionItem.Schedule(onCompleteGetContextLater, result); } }
private void OnSendResponseCompleted(IAsyncResult result) { try { this.context.httpOutput.EndSend(result); ThreadTrace.Trace("End sending http reply"); if (this.closeOutputAfterReply) { this.context.httpOutput.Close(); } } finally { if ((this.message != null) && !object.ReferenceEquals(this.message, this.responseMessage)) { this.responseMessage.Close(); } } }
public override void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout) { if (size <= 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("size", size, System.ServiceModel.SR.GetString("ValueMustBePositive"))); } this.ThrowPendingWriteException(); if (immediate || (this.flushTimeout == 0L)) { ThreadTrace.Trace("BC:Write now"); this.WriteNow(buffer, offset, size, timeout); } else { ThreadTrace.Trace("BC:Write later"); this.WriteLater(buffer, offset, size, timeout); } ThreadTrace.Trace("BC:Write done"); }
protected override void SendReplyCore(Message message, TimeSpan timeout) { this.TraceProcessResponseStart(); ThreadTrace.Trace("Begin sending http reply"); HttpOutput httpOutput = this.GetHttpOutput(message); HttpResponseMessage response = HttpResponseMessageProperty.GetHttpResponseMessageFromMessage(message); if (response != null) { httpOutput.Send(response, timeout); } else { httpOutput.Send(timeout); } ThreadTrace.Trace("End sending http reply"); this.TraceProcessResponseStop(); }
private void OnFlushTimer(object state) { ThreadTrace.Trace("BC:Flush timer"); lock (this.ThisLock) { try { this.FlushCore(this.pendingTimeout); this.pendingTimeout = TimeSpan.Zero; } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.pendingWriteException = exception; this.CancelFlushTimer(); } } }
private void OnMessageDequeued() { ThreadTrace.Trace("message dequeued"); IAsyncResult state = null; lock (base.ThisLock) { if (this.listener != null) { state = this.BeginGetContext(false); } } if ((state != null) && state.CompletedSynchronously) { if (this.onCompleteGetContextLater == null) { this.onCompleteGetContextLater = new Action <object>(this.OnCompleteGetContextLater); } ActionItem.Schedule(this.onCompleteGetContextLater, state); } }
void OnFlushTimer(object state) { ThreadTrace.Trace("BC:Flush timer"); lock (ThisLock) { try { FlushCore(pendingTimeout); pendingTimeout = TimeSpan.Zero; } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } pendingWriteException = e; CancelFlushTimer(); } } }
public override void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager) { if (size <= 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("size", size, SR.GetString( SR.ValueMustBePositive))); } ThrowPendingWriteException(); if (immediate || flushTimeout == 0) { ThreadTrace.Trace("BC:Write now"); WriteNow(buffer, offset, size, timeout, bufferManager); } else { ThreadTrace.Trace("BC:Write later"); WriteLater(buffer, offset, size, timeout); bufferManager.ReturnBuffer(buffer); } ThreadTrace.Trace("BC:Write done"); }
public override void EndWrite() { ThreadTrace.Trace("BC:EndWrite"); base.EndWrite(); }
public override void EndWrite(IAsyncResult result) { ThreadTrace.Trace("BC:EndWrite"); base.EndWrite(result); }