コード例 #1
0
 public void DeferredClose()
 {
     lock (base.SyncRoot)
     {
         if (this._keepAliveJobName != null)
         {
             (base.Scope.GetService(typeof(ISchedulingService)) as ISchedulingService).RemoveScheduledJob(this._keepAliveJobName);
             this._keepAliveJobName = null;
         }
         if (!base.IsDisposed && !this.IsDisconnected)
         {
             this._state = 0;
             IStreamService scopeService = ScopeUtils.GetScopeService(base.Scope, typeof(IStreamService)) as IStreamService;
             if (scopeService != null)
             {
                 lock (((ICollection)this._streams).SyncRoot)
                 {
                     IClientStream[] array = new IClientStream[this._streams.Count];
                     this._streams.Values.CopyTo(array, 0);
                     foreach (IClientStream stream in array)
                     {
                         if (stream != null)
                         {
                             if (log.get_IsDebugEnabled())
                             {
                                 log.Debug("Closing stream: " + stream.StreamId);
                             }
                             scopeService.deleteStream(this, stream.StreamId);
                             this._streamCount--;
                         }
                     }
                     this._streams.Clear();
                 }
             }
             if (((this._bwContext != null) && (base.Scope != null)) && (base.Scope.Context != null))
             {
                 (base.Scope.GetService(typeof(IBWControlService)) as IBWControlService).UnregisterBWControllable(this._bwContext);
                 this._bwContext = null;
             }
             base.Close();
             this._rtmpServer.OnConnectionClose(this);
             this._rtmpNetworkStream.Close();
         }
     }
 }