Example #1
0
 void FeedAgent(ClientIdent ident)
 {
     // send list of app defs belonging to the just connected agent
     {
         var appDefs = from ad in _allAppDefs.AppDefs.Values
                       where ad.Id.MachineId == ident.Name
                       select ad;
         var m = new Net.AppDefsMessage(appDefs, incremental: false);
         _server.SendToSingle(m, ident.Name);
     }
 }
Example #2
0
 /// <summary>
 /// Sends updated app def to their respective agent
 /// This happens when the appdef changes because of plan switch etc.
 /// </summary>
 /// <param name="appDef"></param>
 void SendAppDefAddedOrUpdated(AppDef ad)
 {
     foreach (var cl in _server.Clients)
     {
         if (cl.Name == ad.Id.MachineId || cl.IsGui)
         {
             var m = new Net.AppDefsMessage(new AppDef[1] {
                 ad
             }, incremental: true);
             _server.SendToSingle(m, cl.Name);
         }
     }
 }
Example #3
0
        void FeedGui(ClientIdent ident)
        {
            // send the full list of clients
            {
                foreach ((var id, var state) in _allClientStates.ClientStates)
                {
                    var m = new Net.ClientStateMessage(DateTime.UtcNow, state);
                    _server.SendToSingle(m, ident.Name);
                }
            }

            // send the full list of plans
            {
                var m = new Net.PlanDefsMessage(from p in _plans.Plans.Values select p.Def, incremental: false);
                _server.SendToSingle(m, ident.Name);
            }

            // send the full list of plan states
            {
                var m = new Net.PlansStateMessage(_plans.PlanStates);
                _server.SendToSingle(m, ident.Name);
            }

            // send the full list of app states
            {
                var m = new Net.AppsStateMessage(_allAppStates.AppStates, DateTime.UtcNow);
                _server.SendToSingle(m, ident.Name);
            }

            // send the full list of app defs
            {
                var m = new Net.AppDefsMessage(_allAppDefs.AppDefs.Values, incremental: false);
                _server.SendToSingle(m, ident.Name);
            }

            // send the full list of scripts
            {
                var m = new Net.ScriptDefsMessage(from p in _scripts.Scripts.Values select p.Def, incremental: false);
                _server.SendToSingle(m, ident.Name);
            }

            // send the full list of script states
            {
                var m = new Net.ScriptStateMessage(_scripts.ScriptStates);
                _server.SendToSingle(m, ident.Name);
            }
        }