Example #1
0
        public static void RunAllServices()
        {
            foreach (var Server in AllServers)
            {
                Server.Run();
            }

            //check for disconnected clients
            if (removeList.Count == 0)
            {
                return;
            }
            foreach (var ClientID in removeList)
            {
                foreach (var Server in AllServers)
                {
                    if (Server.RemoveClient(ClientID))
                    {
                        log.Debug($"Client {ClientID} was removed from the client list of the {Server.Name}");
                    }
                    else
                    {
                        log.Debug($"Client {ClientID} could not be removed from the client list of the {Server.Name}");
                    }
                }
                //remove the client from the RGO elements
                ClientSessions[ClientID].DeleteRGORef(ClientID);


                //erase the client from the sesions list
                ClientSessions.Remove(ClientID);
            }
            removeList.Clear();
        }
Example #2
0
        void DisconnectSession(ushort client_id)
        {
            ClientSession clientSession;

            if (ClientSessions.TryGetValue(client_id, out clientSession))
            {
                if (clientSession != null)
                {
                    IStreamConnect client = clientSession.Connect;

                    if (client.IsPublishing)
                    {
                        UnRegisterPublish(client_id);
                    }

                    if (client.IsPlaying)
                    {
                        var client_channels = _routedClients.FindAll((t) => (t.Item1 == client_id || t.Item2 == client_id));
                        _routedClients.RemoveAll((t) => (t.Item1 == client_id));
                        foreach (var i in client_channels)
                        {
                            _routedClients.Remove(i);
                        }
                    }
                    client.OnDisconnected(new ExceptionalEventArgs("disconnected"));
                }
            }

            ClientSessions.Remove(client_id);
        }
        public ActionResult RemoveClient([FromBody] string serverId)
        {
            try
            {
                ClientSessions.Remove(serverId);

                ViewUpdater.Update();

                return(Ok());
            }

            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));

                throw;
            }
        }
        public ActionResult RemoveClients([FromBody] GridModel <ClientUpdateApiModel, string> vm)
        {
            try
            {
                foreach (var item in vm.Deleted)
                {
                    ClientSessions.Remove(item.ServerId);
                }


                ViewUpdater.Update();

                return(Ok());
            }

            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));

                throw;
            }
        }