internal void ReceiveMessage(string channel, byte[] data, int offset, int length)
{
if (this.closed)
{
throw new SystemException();
}
lock (subscriptions)
{
List<SubscriptionRecord> srecs;
subscriptionsMap.TryGetValue(channel, out srecs);
if (srecs == null)
{
// must build this list!
srecs = new List<SubscriptionRecord>();
subscriptionsMap.Add(channel, srecs);
foreach (SubscriptionRecord srec in subscriptions)
{
if (srec.pat.IsMatch(channel))
{
srecs.Add(srec);
}
}
}
foreach (SubscriptionRecord srec in srecs)
{
srec.lcsub.MessageReceived(this, channel, new LCMDataInputStream(data, offset, length));
}
}
}
}