private void SendByte(byte[] reponseMessagePayload)
{
try
{
lock (this.initialQueue)
{
lock (this.segmentQueue)
{
this.httpServerTransport.Send(
null,
reponseMessagePayload,
this.initialQueue.Count != 0 ? this.initialQueue.Peek() : this.segmentQueue.Peek());
}
}
}
catch (ObjectDisposedException e)
{
if (this.logger != null)
{
this.logger.AddWarning(
string.Format("Object disposed exception is catched, detailed information: {0}.", e.Message));
}
else
{
throw;
}
}
lock (this.initialQueue)
{
lock (this.segmentQueue)
{
// Consume the http listener context after the response is sent.
this.initialQueue.Clear();
this.segmentQueue.Clear();
}
}
}