private Task <object> QueueCommandAsTask(Command command, int streamId, int messageStreamId) { if (this.IsDisconnected) { return(RtmpProxySource.CreateExceptedTask((Exception) new ClientDisconnectedException("disconnected"))); } Task <object> task = this._callbackManager.Create(command.InvokeId); this._writer.Queue((RtmpEvent)command, streamId, messageStreamId); return(task); }
private void OnClientAccepted(IAsyncResult ar) { TcpListener asyncState = ar.AsyncState as TcpListener; try { TcpClient client = asyncState.EndAcceptTcpClient(ar); if (!client.Connected) { return; } this._source = new RtmpProxySource(this._serializationContext, this.GetRtmpStream(client)); this._source.RemotingMessageReceived += new EventHandler <RemotingMessageReceivedEventArgs>(this.OnRemotingMessageReceived); this._source.CommandMessageReceived += new EventHandler <CommandMessageReceivedEventArgs>(this.OnCommandMessageReceived); this._source.ConnectMessageReceived += new EventHandler <ConnectMessageEventArgs>(this.OnConnectMessageReceived); this._source.Disconnected += new EventHandler(this.OnClientDisconnected); } catch (ObjectDisposedException ex) { } }
private void OnClientAccepted(IAsyncResult ar) { TcpListener listener = ar.AsyncState as TcpListener; try { TcpClient client = listener.EndAcceptTcpClient(ar); if (!client.Connected) return; var stream = GetRtmpStream(client); _source = new RtmpProxySource(_serializationContext, stream); _source.RemotingMessageReceived += OnRemotingMessageReceived; _source.CommandMessageReceived += OnCommandMessageReceived; _source.ConnectMessageReceived += OnConnectMessageReceived; _source.Disconnected += OnClientDisconnected; } catch (ObjectDisposedException) { //disconnect } }
private void OnClientAccepted(IAsyncResult ar) { var listener = ar.AsyncState as TcpListener; try { var client = listener.EndAcceptTcpClient(ar); if (!client.Connected) { return; } var stream = GetRtmpStream(client); _source = new RtmpProxySource(_serializationContext, stream); _source.RemotingMessageReceived += OnRemotingMessageReceived; _source.CommandMessageReceived += OnCommandMessageReceived; _source.ConnectMessageReceived += OnConnectMessageReceived; _source.Disconnected += OnClientDisconnected; } catch (ObjectDisposedException) { //disconnect } }