This changes avoids us needing to write the proper error-checking code
to see if a queue has been completed vs some unrelated failure.
}
private void ProcessingLoop()
{
- while (this.isActive)
+ foreach (ReceiveMessageInfo msg in this.receiveQueue.GetConsumingEnumerable())
{
- ReceiveMessageInfo msg = this.receiveQueue.Take();
-
try
{
this.ReadCallback(msg.Message, msg.Sender, msg.ConnectionId);
private void SendLoop()
{
- while (this.isActive)
+ foreach (SendMessageInfo msg in this.sendQueue.GetConsumingEnumerable())
{
- SendMessageInfo msg = this.sendQueue.Take();
-
try
{
if (this.socket.Poll(Timeout.Infinite, SelectMode.SelectWrite))