Ejemplo n.º 1
0
 private static void OnWorkerExit(BSPWorkerBase destroyed)
 {
     if (_workers.Contains(destroyed))
     {
         _workers.Remove(destroyed);
     }
 }
Ejemplo n.º 2
0
        private static void InitializeWorkerForChannel(BSPChannel channel, Type workerType)
        {
            if (_workers.Count < Configuration.MaxWorkers)
            {
                // Spawn new worker, which starts it running.
                // It must be a subclass of BSPWorkerBase or this will throw.
                BSPWorkerBase worker = (BSPWorkerBase)Activator.CreateInstance(workerType, new object[] { channel });

                worker.OnExit += OnWorkerExit;
                _workers.Add(worker);
            }
            else
            {
                // Send an Abort with an informative message.
                channel.SendAbort("IFS Server full, try again later.");
            }
        }