示例#1
0
 /// <summary>
 /// Begin disconnect the connection
 /// </summary>
 internal void OnConnectionClose(RtmpServerConnection connection)
 {
     if (!IsDisposed)
     {
         RemoveConnection(connection);
         //connection.Dispose();
     }
 }
示例#2
0
 internal void RemoveConnection(RtmpServerConnection connection)
 {
     if (!this.IsDisposed)
     {
         lock (_connections)
         {
             _connections.Remove(connection);
         }
     }
 }
示例#3
0
 internal void AddConnection(RtmpServerConnection connection)
 {
     if (!this.IsDisposed)
     {
         lock (_connections)
         {
             _connections[connection] = connection;
         }
     }
 }
示例#4
0
 internal RtmpServerConnection[] GetConnections()
 {
     RtmpServerConnection[] connections = null;
     if (!this.IsDisposed)
     {
         lock (_connections)
         {
             connections = new RtmpServerConnection[_connections.Count];
             _connections.Keys.CopyTo(connections, 0);
         }
     }
     return(connections);
 }
示例#5
0
        internal void InitializeConnection(Socket socket)
        {
            if (!IsDisposed)
            {
                RtmpServerConnection connection = null;
                if (_serverCertificate == null)
                {
                    connection = new RtmpServerConnection(this, new RtmpNetworkStream(socket));
                    if (log.IsDebugEnabled)
                    {
                        log.Debug(__Res.GetString(__Res.Rtmp_SocketListenerAccept, connection.ConnectionId));
                    }
                }
                else
                {
                    SslStream sslStream = new SslStream(new NetworkStream(socket, false), false);
                    //sslStream.AuthenticateAsServer(_serverCertificate, false, SslProtocols.Tls, true);
                    sslStream.AuthenticateAsServer(_serverCertificate, false, SslProtocols.Default, false);
                    connection = new RtmpServerConnection(this, new RtmpNetworkStream(socket, sslStream));
                    if (log.IsDebugEnabled)
                    {
                        log.Debug(__Res.GetString(__Res.Rtmp_SocketListenerAccept, connection.ConnectionId));

                        string msg = string.Format("Cipher: {0} strength {1} Hash: {2} strength {3} Key exchange: {4} strength {5} Protocol: {6} Signed: {7} Encrypted: {8}",
                                                   sslStream.CipherAlgorithm, sslStream.CipherStrength,
                                                   sslStream.HashAlgorithm, sslStream.HashStrength,
                                                   sslStream.KeyExchangeAlgorithm, sslStream.KeyExchangeStrength,
                                                   sslStream.SslProtocol, sslStream.IsSigned, sslStream.IsEncrypted);
                        log.Debug(msg);
                    }
                }

                //We are still in an IOCP thread
                this.AddConnection(connection);
                //FluorineRtmpContext.Initialize(connection);
                _rtmpHandler.ConnectionOpened(connection);
                connection.BeginReceive(true);
            }
        }
示例#6
0
		/// <summary>
		/// Begin disconnect the connection
		/// </summary>
        internal void OnConnectionClose(RtmpServerConnection connection)
		{
			if(!IsDisposed)
			{
                RemoveConnection(connection);
                //connection.Dispose();
			}
		}
示例#7
0
        internal void InitializeConnection(Socket socket)
		{
			if(!IsDisposed)
			{
                RtmpServerConnection connection = null;
                if (_serverCertificate == null)
                {
                    connection = new RtmpServerConnection(this, new RtmpNetworkStream(socket));
                    if (log.IsDebugEnabled)
                        log.Debug(__Res.GetString(__Res.Rtmp_SocketListenerAccept, connection.ConnectionId));
                }
                else
                {
                    SslStream sslStream = new SslStream(new NetworkStream(socket, false), false);
                    //sslStream.AuthenticateAsServer(_serverCertificate, false, SslProtocols.Tls, true);
                    sslStream.AuthenticateAsServer(_serverCertificate, false, SslProtocols.Default, false);
                    connection = new RtmpServerConnection(this, new RtmpNetworkStream(socket, sslStream));
                    if (log.IsDebugEnabled)
                    {
                        log.Debug(__Res.GetString(__Res.Rtmp_SocketListenerAccept, connection.ConnectionId));

                        string msg = string.Format("Cipher: {0} strength {1} Hash: {2} strength {3} Key exchange: {4} strength {5} Protocol: {6} Signed: {7} Encrypted: {8}",
                            sslStream.CipherAlgorithm, sslStream.CipherStrength,
                            sslStream.HashAlgorithm, sslStream.HashStrength,
                            sslStream.KeyExchangeAlgorithm, sslStream.KeyExchangeStrength,
                            sslStream.SslProtocol, sslStream.IsSigned, sslStream.IsEncrypted);
                        log.Debug(msg);
                    }
                }

                //We are still in an IOCP thread 
                this.AddConnection(connection);
                //FluorineRtmpContext.Initialize(connection);
                _rtmpHandler.ConnectionOpened(connection);
                connection.BeginReceive(true);
			}
		}
示例#8
0
        internal void RemoveConnection(RtmpServerConnection connection)
		{
			if(!this.IsDisposed)
			{
				lock(_connections)
				{
                    _connections.Remove(connection);
				}
			}
		}
示例#9
0
        internal void AddConnection(RtmpServerConnection connection)
		{
			if(!this.IsDisposed)
			{
				lock(_connections)
				{
                    _connections[connection] = connection;
				}
			}

		}
示例#10
0
        internal RtmpServerConnection[] GetConnections()
		{
            RtmpServerConnection[] connections = null;
			if(!this.IsDisposed)
			{
				lock(_connections)
				{
                    connections = new RtmpServerConnection[_connections.Count];
                    _connections.Keys.CopyTo(connections, 0);
				}

			}
            return connections;
		}