diff options
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 76 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Main.cs | 1 |
2 files changed, 73 insertions, 4 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index e32f551..2e6a892 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Data; | 38 | using OpenSim.Framework.Data; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | using OpenSim.Framework.Data.MySQL; | ||
40 | 41 | ||
41 | namespace OpenSim.Grid.GridServer | 42 | namespace OpenSim.Grid.GridServer |
42 | { | 43 | { |
@@ -301,16 +302,20 @@ namespace OpenSim.Grid.GridServer | |||
301 | catch (KeyNotFoundException) { } | 302 | catch (KeyNotFoundException) { } |
302 | 303 | ||
303 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); | 304 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize)); |
304 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 305 | TheSim.serverURI = (string)requestData["server_uri"]; |
306 | Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + | ||
307 | TheSim.serverURI); | ||
305 | 308 | ||
306 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; | 309 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; |
307 | 310 | ||
308 | TheSim.regionName = (string)requestData["sim_name"]; | 311 | TheSim.regionName = (string)requestData["sim_name"]; |
309 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); | 312 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); |
313 | TheSim.originUUID = new LLUUID((string) requestData["originUUID"]); | ||
310 | 314 | ||
311 | //make sure there is not an existing region at this location | 315 | //make sure there is not an existing region at this location |
312 | OldSim = getRegion(TheSim.regionHandle); | 316 | OldSim = getRegion(TheSim.regionHandle); |
313 | if (OldSim == null || OldSim.UUID == TheSim.UUID) | 317 | //if (OldSim == null || OldSim.UUID == TheSim.UUID) |
318 | if (OldSim == null || OldSim.UUID == TheSim.UUID || TheSim.UUID != TheSim.originUUID) | ||
314 | { | 319 | { |
315 | bool brandNew = ( OldSim == null && TheSim.regionRecvKey == config.SimSendKey && | 320 | bool brandNew = ( OldSim == null && TheSim.regionRecvKey == config.SimSendKey && |
316 | TheSim.regionSendKey == config.SimRecvKey); | 321 | TheSim.regionSendKey == config.SimRecvKey); |
@@ -502,6 +507,69 @@ namespace OpenSim.Grid.GridServer | |||
502 | 507 | ||
503 | /// <summary> | 508 | /// <summary> |
504 | /// Returns an XML RPC response to a simulator profile request | 509 | /// Returns an XML RPC response to a simulator profile request |
510 | /// Performed after moving a region. | ||
511 | /// </summary> | ||
512 | /// <param name="request"></param> | ||
513 | /// <returns></returns> | ||
514 | /// <param name="request">The XMLRPC Request</param> | ||
515 | /// <returns>Processing parameters</returns> | ||
516 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) | ||
517 | { | ||
518 | XmlRpcResponse response = new XmlRpcResponse(); | ||
519 | Hashtable responseData = new Hashtable(); | ||
520 | response.Value = responseData; | ||
521 | |||
522 | //RegionProfileData TheSim = null; | ||
523 | string uuid = String.Empty;; | ||
524 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
525 | string myword; | ||
526 | if (requestData.ContainsKey("UUID")) { | ||
527 | //TheSim = getRegion(new LLUUID((string) requestData["UUID"])); | ||
528 | uuid = requestData["UUID"].ToString(); | ||
529 | Console.WriteLine("deleting region " + uuid); | ||
530 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); | ||
531 | } | ||
532 | else { | ||
533 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to delete"; | ||
534 | return response; | ||
535 | } | ||
536 | |||
537 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) { | ||
538 | //OpenSim.Framework.Data.MySQL.MySQLGridData dbengine = new OpenSim.Framework.Data.MySQL.MySQLGridData(); | ||
539 | try { | ||
540 | OpenSim.Framework.Data.MySQL.MySQLGridData mysqldata = (OpenSim.Framework.Data.MySQL.MySQLGridData)(kvp.Value); | ||
541 | //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); | ||
542 | DataResponse insertResponse = mysqldata.DeleteProfile(uuid); | ||
543 | switch (insertResponse) { | ||
544 | case DataResponse.RESPONSE_OK: | ||
545 | //MainLog.Instance.Verbose("grid", "Deleting region successful: " + uuid); | ||
546 | responseData["status"] = "Deleting region successful: " + uuid; | ||
547 | break; | ||
548 | case DataResponse.RESPONSE_ERROR: | ||
549 | //MainLog.Instance.Warn("storage", "Deleting region failed (Error): " + uuid); | ||
550 | responseData["status"] = "Deleting region failed (Error): " + uuid; | ||
551 | break; | ||
552 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | ||
553 | //MainLog.Instance.Warn("storage", "Deleting region failed (Invalid Credentials): " + uuid); | ||
554 | responseData["status"] = "Deleting region (Invalid Credentials): " + uuid; | ||
555 | break; | ||
556 | case DataResponse.RESPONSE_AUTHREQUIRED: | ||
557 | //MainLog.Instance.Warn("storage", "Deleting region failed (Authentication Required): " + uuid); | ||
558 | responseData["status"] = "Deleting region (Authentication Required): " + uuid; | ||
559 | break; | ||
560 | } | ||
561 | } | ||
562 | catch (Exception e) { | ||
563 | m_log.Error("storage Unable to delete region " + uuid + " via MySQL"); | ||
564 | //MainLog.Instance.Warn("storage", e.ToString()); | ||
565 | } | ||
566 | } | ||
567 | |||
568 | return response; | ||
569 | } | ||
570 | |||
571 | /// <summary> | ||
572 | /// Returns an XML RPC response to a simulator profile request | ||
505 | /// </summary> | 573 | /// </summary> |
506 | /// <param name="request"></param> | 574 | /// <param name="request"></param> |
507 | /// <returns></returns> | 575 | /// <returns></returns> |
@@ -533,6 +601,7 @@ namespace OpenSim.Grid.GridServer | |||
533 | (string) requestData["region_handle"]); | 601 | (string) requestData["region_handle"]); |
534 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); | 602 | responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); |
535 | responseData["sim_port"] = simData.serverPort.ToString(); | 603 | responseData["sim_port"] = simData.serverPort.ToString(); |
604 | responseData["server_uri"] = simData.serverURI; | ||
536 | responseData["http_port"] = simData.httpPort.ToString(); | 605 | responseData["http_port"] = simData.httpPort.ToString(); |
537 | responseData["remoting_port"] = simData.remotingPort.ToString(); | 606 | responseData["remoting_port"] = simData.remotingPort.ToString(); |
538 | responseData["region_locx"] = simData.regionLocX.ToString(); | 607 | responseData["region_locx"] = simData.regionLocX.ToString(); |
@@ -798,8 +867,7 @@ namespace OpenSim.Grid.GridServer | |||
798 | } | 867 | } |
799 | } | 868 | } |
800 | 869 | ||
801 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 870 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; |
802 | |||
803 | bool requirePublic = false; | 871 | bool requirePublic = false; |
804 | bool requireValid = true; | 872 | bool requireValid = true; |
805 | 873 | ||
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index ff4a888..ff4cfa2 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -113,6 +113,7 @@ namespace OpenSim.Grid.GridServer | |||
113 | 113 | ||
114 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 114 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); |
115 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | 115 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); |
116 | httpServer.AddXmlRPCHandler("simulator_after_region_moved", m_gridManager.XmlRpcDeleteRegionMethod); | ||
116 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | 117 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); |
117 | 118 | ||
118 | // Message Server ---> Grid Server | 119 | // Message Server ---> Grid Server |