Example #1
0
        public object GetInstance(InstanceContext instanceContext, Message message)
        {
            if (message == null)
            {
                throw new ApplicationException("Empty message");
            }
            var s = message.Headers.GetHeader <string>(ChatRoom.ChatRoomNameHeader, Namespaces.HeaderNamespace);
            ChatsService <T> service = ((ServiceHostWithChats <T>)instanceContext.Host).ChatsService;

            service.PerfCounters.Count(PerfCounters.ChatCommands2ServerPerSecond);

            ClaimsPolicy.ServerCheck();

            return(service.Rooms[service.FindRoomWithCheck(s)]);
        }
Example #2
0
        public string Restart()
        {
            // since this method can be called from GeneralMessage(...)
            ClaimsPolicy.ServerMethodCheck(typeof(IContract).GetMethod(MethodBase.GetCurrentMethod().Name));

            //1.	Server broadcasts to clients about start of technical restart
            BroadcastsChannel.ServerRestarted(false, Sender.ClientUniqueKey);

            //2.	Clients have to pause all their network activities
            //3.	Server blocks all incoming requests from clients, but server finishes all current activities – it does not abort them.
            //4.	Server stores list of clients connected (sClients) and other internal data like ChatRooms, RecordLocks etc
            //5.	Windows service is stopped without clients disconnecting (but their channels are broken)
            //6.	New binaries are copied
            //7.	Windows service is started
            //8.	New Server allows incoming requests for connection only from previously connected clients (sClients)
            //9.	Server waits till 10 seconds until all sClients will be reconnected
            //10.	Server restores previous internal data for clients that were reconnected successfully.
            //11.	Server allows all incoming requests from clients.

            //12.	Server broadcasts to clients about end of technical restart
            BroadcastsChannel.ServerRestarted(true, Sender.ClientUniqueKey);
            return(null);
        }