// reject all requests
internal void Drain()
{
_draining = true;
// wait for all work items to finish
while (_workItemCount > 0)
{
Thread.Sleep(100);
}
// is queue empty?
if (_count == 0)
{
return;
}
for (;;)
{
SocketHandler sh = DequeueRequest(false);
if (sh == null)
{
break;
}
sh.RejectRequestNowSinceServerIsBusy();
}
}