private void HandleRequestConfigCommand(MasterControlClient session, RouterMessage msg)
 {
     msg.RespondJson(new LoginServerConfig
     {
         enviornment                = Program.cfg.general.enviornment,
         mongodb_connection         = Program.cfg.general.mongodb_connection,
         steam_api_key              = Program.cfg.general.steam_api_token,
         steam_cache_expire_minutes = Program.cfg.general.steam_cache_expire_minutes,
         firebase_uc_bucket         = Program.cfg.general.firebase_uc_bucket,
         log             = Program.cfg.general.log,
         steam_token_key = Program.cfg.secrets.steam_token_key,
         hosts           = Program.cfg.hosts
     }, true);
 }
示例#2
0
        private void HandleRequestConfigCommand(RouterSession session, RouterMessage msg)
        {
            //Create LoginServerInfo to return
            LoginServerInfo response = new LoginServerInfo
            {
                success     = true,
                instance_id = session.linkedInstance.id.ToString(),
                user_ports  = session.linkedInstance.ports,
                config      = this.session.remoteConfig
            };

            //Respond
            msg.RespondJson(response, true);
        }
示例#3
0
 private void OnCmdGetStatus(RouterMessage msg)
 {
     //Produce and respond with thatus
     msg.RespondJson(new ManagerStatusMessage
     {
         host_name         = System.Environment.MachineName,
         host_os           = System.Environment.OSVersion.Platform.ToString().ToUpper(),
         current_time      = DateTime.UtcNow,
         start_time        = Program.startTime,
         version_app_major = Program.APP_VERSION_MAJOR,
         version_app_minor = Program.APP_VERSION_MINOR,
         version_lib_major = DeltaConnection.LIB_VERSION_MAJOR,
         version_lib_minor = DeltaConnection.LIB_VERSION_MINOR
     }, true);
 }
示例#4
0
 private void MasterConnection_OnRouterReceiveMessage(RouterMessage msg)
 {
     if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_STATUS)
     {
         OnCmdGetStatus(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_ADDPACKAGE)
     {
         OnCmdAddPackage(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_ADDVERSION)
     {
         OnCmdAddVersion(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_ADDINSTANCE)
     {
         OnCmdAddInstance(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_LISTPACKAGES)
     {
         msg.RespondJson(MiscTools.DictToList(session.packages), true);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_LISTVERSIONS)
     {
         msg.RespondJson(MiscTools.DictToList(session.versions), true);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_LISTINSTANCES)
     {
         msg.RespondJson(session.instances, true);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_UPDATEINSTANCE)
     {
         OnCmdUpdateInstance(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_DESTROYINSTANCE)
     {
         OnCmdRemoveInstance(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_DELETEVERSION)
     {
         OnCmdDeleteVersion(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_ADDSITE)
     {
         OnCmdAddSite(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_LISTSITES)
     {
         msg.RespondJson(MiscTools.DictToList(session.sites), true);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_M_ASSIGNSITE)
     {
         OnCmdAssignSite(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_REBOOT_INSTANCE)
     {
         OnCmdRebootInstance(msg);
     }
     else if (msg.opcode == MasterConnectionOpcodes.OPCODE_MASTER_PING_INSTANCE)
     {
         OnCmdGetInstanceStatus(msg).GetAwaiter().GetResult();
     }
     else
     {
         Log("MasterConnection_OnRouterReceiveMessage", $"Got message with unknown opcode {msg.opcode}.", DeltaLogLevel.Medium);
     }
 }