public override void RegisterListener (ChannelDispatcher channel, TimeSpan timeout)
{
RegisterListenerCommon (channel, timeout);
if (Entries.Count != 1)
return;
// Start here. It is shared between channel listeners
// that share the same listen Uri. So there is no other appropriate place.
#if USE_SEPARATE_LOOP // this cannot be enabled because it causes infinite loop when ChannelDispatcher is not involved.
loop = new Thread (new ThreadStart (delegate {
listener.Start ();
try {
while (true)
ProcessNewContext (listener.GetContext ());
} catch (ThreadAbortException) {
Thread.ResetAbort ();
}
listener.Stop ();
}));
loop.Start ();
#else
listener.Start ();
listener.BeginGetContext (GetContextCompleted, null);
#endif
}