示例#1
0
 public RtmptConnection(RtmptServer rtmptServer, IPEndPoint ipEndPoint, string path, Hashtable parameters)
     : base(rtmptServer.RtmpHandler, RtmpMode.Server, path, parameters)
 {
     _lock = new FastReaderWriterLock();
     _remoteEndPoint = ipEndPoint;
     _rtmptServer = rtmptServer;
     _readBytes = new AtomicLong();
     _writtenBytes = new AtomicLong();
     _session = rtmptServer.Endpoint.GetMessageBroker().SessionManager.CreateSession(this);
 }
        // <summary>
        // Name of job that is waiting for a valid handshake.
        // </summary>
        //private string _waitForHandshakeJob;
        
        public RtmpServerConnection(RtmpServer rtmpServer, RtmpNetworkStream stream)
            : base(rtmpServer.RtmpHandler, RtmpMode.Server, null, null)
		{
            _lock = new FastReaderWriterLock();
            _endpoint = rtmpServer.Endpoint;
            _readBuffer = ByteBuffer.Allocate(4096);
            _readBuffer.Flip();

			// We start with an anonymous connection without a scope.
			// These parameters will be set during the call of "connect" later.
            _rtmpServer = rtmpServer;
            _rtmpNetworkStream = stream;
            //_state = RtmpConnectionState.Active;
            SetIsTunneled(false);
            IsTunnelingDetected = false;

            _readBytes = new AtomicLong();
            _writtenBytes = new AtomicLong();

            //Set the legacy collection flag from the endpoint channel settings
            this.Context.UseLegacyCollection = (_endpoint as RtmpEndpoint).IsLegacyCollection;
            this.Context.UseLegacyThrowable = (_endpoint as RtmpEndpoint).IsLegacyThrowable;
		}