public override IDataTransferable Duplicate() { GridSessionID m = new GridSessionID(); m.FromOSD(ToOSD()); return(m); }
/// <summary> /// Register this region with the grid service /// </summary> /// <param name = "scene"></param> /// <param name = "returnResponseFirstTime">Should we try to walk the user through what went wrong?</param> /// <param name="continueTrying"> </param> /// <param name="password"> </param> public bool RegisterRegionWithGrid(IScene scene, bool returnResponseFirstTime, bool continueTrying, string password) { GridRegion region = BuildGridRegion(scene.RegionInfo); IGenericsConnector g = DataManager.DataManager.RequestPlugin<IGenericsConnector>(); GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface<IGridService>(); if (g != null) //Get the sessionID from the database if possible s = g.GetGeneric<GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID"); if (s == null) { s = new GridSessionID {SessionID = scene.RegionInfo.GridSecureSessionID}; //Set it from the regionInfo if it knows anything } scene.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region); //Tell the grid service about us RegisterRegion error = GridService.RegisterRegion(region, s.SessionID, password); if (error.Error == String.Empty) { s.SessionID = error.SessionID; //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it scene.RegionInfo.GridSecureSessionID = error.SessionID; //Update our local copy of what our region flags are scene.RegionInfo.RegionFlags = error.RegionFlags; scene.RegionInfo.ScopeID = error.Region.ScopeID; scene.RegionInfo.AllScopeIDs = error.Region.AllScopeIDs; //Save the new SessionID to the database if (g != null) g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD()); m_knownNeighbors[scene.RegionInfo.RegionID] = error.Neighbors; return true; //Success } if (returnResponseFirstTime && !continueTrying) { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region with grid failed again - " + error.Error); return false; } //Parse the error and try to do something about it if at all possible if (error.Error == "Region location is reserved") { MainConsole.Instance.Error( "[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.Prompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.Prompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X*Constants.RegionSize; scene.RegionInfo.RegionLocY = Y*Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } else if (error.Error == "Region overlaps another region") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region."); int X = 0, Y = 0; int.TryParse( MainConsole.Instance.Prompt("New Region Location X", (scene.RegionInfo.RegionLocX/256).ToString()), out X); int.TryParse( MainConsole.Instance.Prompt("New Region Location Y", (scene.RegionInfo.RegionLocY/256).ToString()), out Y); scene.RegionInfo.RegionLocX = X*Constants.RegionSize; scene.RegionInfo.RegionLocY = Y*Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } else if (error.Error.Contains("Can't move this region")) { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position."); //Opensim Grid Servers don't have this functionality. try { string[] position = error.Error.Split(','); scene.RegionInfo.RegionLocX = int.Parse(position[1])*Constants.RegionSize; scene.RegionInfo.RegionLocY = int.Parse(position[2])*Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } catch (Exception e) { MainConsole.Instance.Error( "Unable to move the region back to its original position, is this an opensim server? Please manually move the region back."); throw e; } } else if (error.Error == "Duplicate region name") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name."); string oldRegionName = scene.RegionInfo.RegionName; scene.RegionInfo.RegionName = MainConsole.Instance.Prompt("New Region Name", ""); IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(oldRegionName, scene.RegionInfo); } } else if (error.Error == "Region locked out") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid the failed - The region you are attempting to join has been blocked from connecting. Please connect another region."); MainConsole.Instance.Prompt("Press enter when you are ready to exit"); Environment.Exit(0); } else if (error.Error == "Could not reach grid service") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The grid service can not be found! Please make sure that you can connect to the grid server and that the grid server is on."); MainConsole.Instance.Error( "You should also make sure you've provided the correct address and port of the grid service."); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else if (error.Error == "Wrong Session ID") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - Wrong Session ID for this region!"); MainConsole.Instance.Error( "This means that this region has failed to connect to the grid server and needs removed from it before it can connect again."); MainConsole.Instance.Error( "If you are running the Aurora.Server instance this region is connecting to, type \"clear grid region <RegionName>\" and then press enter on this console and it will work"); MainConsole.Instance.Error( "If you are not running the Aurora.Server instance this region is connecting to, please contact your grid operator so that he can fix it"); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") Environment.Exit(0); } else { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - " + error.Error + "!"); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") Environment.Exit(0); } return RegisterRegionWithGrid(scene, true, continueTrying, password); }
/// <summary> /// Register this region with the grid service /// </summary> /// <param name = "scene"></param> /// <param name = "returnResponseFirstTime">Should we try to walk the user through what went wrong?</param> /// <param name="continueTrying"> </param> /// <param name="password"> </param> public bool RegisterRegionWithGrid(IScene scene, bool returnResponseFirstTime, bool continueTrying, string password) { GridRegion region = BuildGridRegion(scene.RegionInfo); IGenericsConnector g = DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface <IGridService>(); if (g != null) //Get the sessionID from the database if possible { s = g.GetGeneric <GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID"); } if (s == null) { s = new GridSessionID { SessionID = scene.RegionInfo.GridSecureSessionID }; //Set it from the regionInfo if it knows anything } scene.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region); //Tell the grid service about us RegisterRegion error = GridService.RegisterRegion(region, s.SessionID, password); if (error.Error == String.Empty) { s.SessionID = error.SessionID; //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it scene.RegionInfo.GridSecureSessionID = error.SessionID; //Update our local copy of what our region flags are scene.RegionInfo.RegionFlags = error.RegionFlags; scene.RegionInfo.ScopeID = error.Region.ScopeID; scene.RegionInfo.AllScopeIDs = error.Region.AllScopeIDs; //Save the new SessionID to the database if (g != null) { g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD()); } m_knownNeighbors[scene.RegionInfo.RegionID] = error.Neighbors; return(true); //Success } if (returnResponseFirstTime && !continueTrying) { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region with grid failed again - " + error.Error); return(false); } //Parse the error and try to do something about it if at all possible if (error.Error == "Region location is reserved") { MainConsole.Instance.Error( "[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.Prompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.Prompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } else if (error.Error == "Region overlaps another region") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region."); int X = 0, Y = 0; int.TryParse( MainConsole.Instance.Prompt("New Region Location X", (scene.RegionInfo.RegionLocX / 256).ToString()), out X); int.TryParse( MainConsole.Instance.Prompt("New Region Location Y", (scene.RegionInfo.RegionLocY / 256).ToString()), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } else if (error.Error.Contains("Can't move this region")) { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position."); //Opensim Grid Servers don't have this functionality. try { string[] position = error.Error.Split(','); scene.RegionInfo.RegionLocX = int.Parse(position[1]) * Constants.RegionSize; scene.RegionInfo.RegionLocY = int.Parse(position[2]) * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } catch (Exception e) { MainConsole.Instance.Error( "Unable to move the region back to its original position, is this an opensim server? Please manually move the region back."); throw e; } } else if (error.Error == "Duplicate region name") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name."); string oldRegionName = scene.RegionInfo.RegionName; scene.RegionInfo.RegionName = MainConsole.Instance.Prompt("New Region Name", ""); IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(oldRegionName, scene.RegionInfo); } } else if (error.Error == "Region locked out") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid the failed - The region you are attempting to join has been blocked from connecting. Please connect another region."); MainConsole.Instance.Prompt("Press enter when you are ready to exit"); Environment.Exit(0); } else if (error.Error == "Could not reach grid service") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The grid service can not be found! Please make sure that you can connect to the grid server and that the grid server is on."); MainConsole.Instance.Error( "You should also make sure you've provided the correct address and port of the grid service."); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else if (error.Error == "Wrong Session ID") { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - Wrong Session ID for this region!"); MainConsole.Instance.Error( "This means that this region has failed to connect to the grid server and needs removed from it before it can connect again."); MainConsole.Instance.Error( "If you are running the Aurora.Server instance this region is connecting to, type \"clear grid region <RegionName>\" and then press enter on this console and it will work"); MainConsole.Instance.Error( "If you are not running the Aurora.Server instance this region is connecting to, please contact your grid operator so that he can fix it"); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else { MainConsole.Instance.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - " + error.Error + "!"); string input = MainConsole.Instance.Prompt( "Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } return(RegisterRegionWithGrid(scene, true, continueTrying, password)); }
public override IDataTransferable Duplicate() { GridSessionID m = new GridSessionID(); m.FromOSD(ToOSD()); return m; }
/// <summary> /// Register this region with the grid service /// </summary> /// <param name="scene"></param> public void RegisterRegionWithGrid(IScene scene) { GridRegion region = BuildGridRegion(scene.RegionInfo); IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>(); GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface<IGridService>(); if (g != null) //Get the sessionID from the database if possible s = g.GetGeneric<GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", new GridSessionID()); if (s == null) { s = new GridSessionID(); //Set it from the regionInfo if it knows anything s.SessionID = scene.RegionInfo.GridSecureSessionID; } scene.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region); List<GridRegion> neighbors = new List<GridRegion> (); //Tell the grid service about us string error = GridService.RegisterRegion (region, s.SessionID, out s.SessionID, out neighbors); if (error == String.Empty) { //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it scene.RegionInfo.GridSecureSessionID = s.SessionID; //Save the new SessionID to the database g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD()); m_knownNeighbors[scene.RegionInfo.RegionID] = neighbors; } else { //Parse the error and try to do something about it if at all possible if (error == "Region location is reserved") { m_log.Error("[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } if (error == "Region overlaps another region") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } if (error.Contains("Can't move this region")) { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position."); //Opensim Grid Servers don't have this functionality. try { string[] position = error.Split(','); scene.RegionInfo.RegionLocX = int.Parse(position[1]) * Constants.RegionSize; scene.RegionInfo.RegionLocY = int.Parse(position[2]) * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } catch (Exception e) { m_log.Error("Unable to move the region back to its original position, is this an opensim server? Please manually move the region back."); throw e; } } if (error == "Duplicate region name") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name."); string oldRegionName = scene.RegionInfo.RegionName; scene.RegionInfo.RegionName = MainConsole.Instance.CmdPrompt("New Region Name", ""); IRegionLoader[] loaders = scene.RequestModuleInterfaces<IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(oldRegionName, scene.RegionInfo); } } if (error == "Region locked out") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid the failed - The region you are attempting to join has been blocked from connecting. Please connect another region."); MainConsole.Instance.CmdPrompt("Press enter when you are ready to exit"); Environment.Exit(0); } if (error == "Error communicating with grid service") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The grid service can not be found! Please make sure that you can connect to the grid server and that the grid server is on."); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } if (error == "Wrong Session ID") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - Wrong Session ID for this region!"); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - " + error + "!"); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } RegisterRegionWithGrid(scene); } }
/// <summary> /// Register this region with the grid service /// </summary> /// <param name="scene"></param> public void RegisterRegionWithGrid(IScene scene) { GridRegion region = BuildGridRegion(scene.RegionInfo); IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface <IGridService>(); if (g != null) //Get the sessionID from the database if possible { s = g.GetGeneric <GridSessionID>(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", new GridSessionID()); } if (s == null) { s = new GridSessionID(); //Set it from the regionInfo if it knows anything s.SessionID = scene.RegionInfo.GridSecureSessionID; } scene.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler("PreRegisterRegion", region); //Tell the grid service about us string error = GridService.RegisterRegion(region, s.SessionID, out s.SessionID); if (error == String.Empty) { //If it registered ok, we save the sessionID to the database and tlel the neighbor service about it scene.RegionInfo.GridSecureSessionID = s.SessionID; //Save the new SessionID to the database g.AddGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", s.ToOSD()); } else { //Parse the error and try to do something about it if at all possible if (error == "Region location is reserved") { m_log.Error("[RegisterRegionWithGrid]: Registration of region with grid failed - The region location you specified is reserved. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } if (error == "Region overlaps another region") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region location you specified is already in use. You must move your region."); int X = 0, Y = 0; int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location X", "1000"), out X); int.TryParse(MainConsole.Instance.CmdPrompt("New Region Location Y", "1000"), out Y); scene.RegionInfo.RegionLocX = X * Constants.RegionSize; scene.RegionInfo.RegionLocY = Y * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } if (error.Contains("Can't move this region")) { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - You can not move this region. Moving it back to its original position."); //Opensim Grid Servers don't have this functionality. try { string[] position = error.Split(','); scene.RegionInfo.RegionLocX = int.Parse(position[1]) * Constants.RegionSize; scene.RegionInfo.RegionLocY = int.Parse(position[2]) * Constants.RegionSize; IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(scene.RegionInfo.RegionName, scene.RegionInfo); } } catch (Exception e) { m_log.Error("Unable to move the region back to its original position, is this an opensim server? Please manually move the region back."); throw e; } } if (error == "Duplicate region name") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The region name you specified is already in use. Please change the name."); string oldRegionName = scene.RegionInfo.RegionName; scene.RegionInfo.RegionName = MainConsole.Instance.CmdPrompt("New Region Name", ""); IRegionLoader[] loaders = scene.RequestModuleInterfaces <IRegionLoader>(); foreach (IRegionLoader loader in loaders) { loader.UpdateRegionInfo(oldRegionName, scene.RegionInfo); } } if (error == "Region locked out") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid the failed - The region you are attempting to join has been blocked from connecting. Please connect another region."); MainConsole.Instance.CmdPrompt("Press enter when you are ready to exit"); Environment.Exit(0); } if (error == "Error communicating with grid service") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - The grid service can not be found! Please make sure that you can connect to the grid server and that the grid server is on."); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } if (error == "Wrong Session ID") { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - Wrong Session ID for this region!"); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } else { m_log.Error("[RegisterRegionWithGrid]: Registration of region " + scene.RegionInfo.RegionName + " with the grid failed - " + error + "!"); string input = MainConsole.Instance.CmdPrompt("Press enter when you are ready to proceed, or type cancel to exit"); if (input == "cancel") { Environment.Exit(0); } } RegisterRegionWithGrid(scene); } }
/// <summary> /// Register this region with a grid service /// </summary> /// <exception cref="System.Exception">Thrown if registration of the region itself fails.</exception> public string RegisterRegionWithGrid() { m_sceneGridService.SetScene(this); // These two 'commands' *must be* next to each other or sim rebooting fails. //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); GridRegion region = new GridRegion(RegionInfo); IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>(); GridSessionID s = null; if (g != null) //Get the sessionID from the database if possible s = g.GetGeneric<GridSessionID>(RegionInfo.RegionID, "GridSessionID", GridService.GridServiceURL, new GridSessionID()); if (s == null) { s = new GridSessionID(); //Set it from the regionInfo if it knows anything s.SessionID = RegionInfo.GridSecureSessionID; } string error = GridService.RegisterRegion(RegionInfo.ScopeID, region, s.SessionID, out s.SessionID); if (error != String.Empty) return error; RegionInfo.GridSecureSessionID = s.SessionID; //Save the new SessionID to the database g.AddGeneric(RegionInfo.RegionID, "GridSessionID", GridService.GridServiceURL, s.ToOSD()); m_sceneGridService.SetScene(this); m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); return ""; }