/// <summary> /// Begin disconnect the connection /// </summary> internal void OnConnectionClose(RtmpServerConnection connection) { if (!IsDisposed) { RemoveConnection(connection); //connection.Dispose(); } }
internal void RemoveConnection(RtmpServerConnection connection) { if (!this.IsDisposed) { lock (_connections) { _connections.Remove(connection); } } }
internal void AddConnection(RtmpServerConnection connection) { if (!this.IsDisposed) { lock (_connections) { _connections[connection] = connection; } } }
internal RtmpServerConnection[] GetConnections() { RtmpServerConnection[] connections = null; if (!this.IsDisposed) { lock (_connections) { connections = new RtmpServerConnection[_connections.Count]; _connections.Keys.CopyTo(connections, 0); } } return(connections); }
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); } }
/// <summary> /// Begin disconnect the connection /// </summary> internal void OnConnectionClose(RtmpServerConnection connection) { if(!IsDisposed) { RemoveConnection(connection); //connection.Dispose(); } }
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); } }
internal void RemoveConnection(RtmpServerConnection connection) { if(!this.IsDisposed) { lock(_connections) { _connections.Remove(connection); } } }
internal void AddConnection(RtmpServerConnection connection) { if(!this.IsDisposed) { lock(_connections) { _connections[connection] = connection; } } }
internal RtmpServerConnection[] GetConnections() { RtmpServerConnection[] connections = null; if(!this.IsDisposed) { lock(_connections) { connections = new RtmpServerConnection[_connections.Count]; _connections.Keys.CopyTo(connections, 0); } } return connections; }