aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs80
1 files changed, 46 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 7f9167d..fd5ccee 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -45,7 +45,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
45 45
46namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion 46namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
47{ 47{
48 public class RESTInterregionComms : IRegionModule, IInterregionCommsOut 48 public class RESTInterregionComms : ISharedRegionModule, IInterregionCommsOut
49 { 49 {
50 private bool initialized = false; 50 private bool initialized = false;
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -64,51 +64,63 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
64 64
65 #region IRegionModule 65 #region IRegionModule
66 66
67 public virtual void Initialise(Scene scene, IConfigSource config) 67 public virtual void Initialise(IConfigSource config)
68 { 68 {
69 if (!initialized) 69 IConfig startupConfig = config.Configs["Communications"];
70 {
71 initialized = true;
72 IConfig startupConfig = config.Configs["Communications"];
73
74 if ((startupConfig == null)
75 || (startupConfig != null)
76 && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms"))
77 {
78 m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
79 m_enabled = true;
80 if (config.Configs["Hypergrid"] != null)
81 m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
82 70
83 InitOnce(scene); 71 if ((startupConfig == null) || ((startupConfig != null)
84 } 72 && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms")))
73 {
74 m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
75 m_enabled = true;
76 if (config.Configs["Hypergrid"] != null)
77 m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
85 } 78 }
79 }
86 80
87 if (!m_enabled) 81 public virtual void PostInitialise()
88 return; 82 {
83 }
89 84
90 InitEach(scene); 85 public virtual void Close()
86 {
87 }
91 88
89 public void AddRegion(Scene scene)
90 {
92 } 91 }
93 92
94 public virtual void PostInitialise() 93 public void RemoveRegion(Scene scene)
95 { 94 {
96 if (m_enabled) 95 if (m_enabled)
97 AddHTTPHandlers(); 96 {
97 m_localBackend.RemoveScene(scene);
98 scene.UnregisterModuleInterface<IInterregionCommsOut>(this);
99 }
98 } 100 }
99 101
100 public virtual void Close() 102 public void RegionLoaded(Scene scene)
101 { 103 {
104 if (m_enabled)
105 {
106 if (!initialized)
107 {
108 InitOnce(scene);
109 initialized = true;
110 AddHTTPHandlers();
111 }
112 InitEach(scene);
113 }
102 } 114 }
103 115
104 public virtual string Name 116 public Type ReplacableInterface
105 { 117 {
106 get { return "RESTInterregionCommsModule"; } 118 get { return null; }
107 } 119 }
108 120
109 public virtual bool IsSharedModule 121 public virtual string Name
110 { 122 {
111 get { return true; } 123 get { return "RESTInterregionCommsModule"; }
112 } 124 }
113 125
114 protected virtual void InitEach(Scene scene) 126 protected virtual void InitEach(Scene scene)
@@ -137,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
137 #region IInterregionComms 149 #region IInterregionComms
138 150
139 /** 151 /**
140 * Agent-related communications 152 * Agent-related communications
141 */ 153 */
142 154
143 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) 155 public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
@@ -257,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
257 } 269 }
258 270
259 /** 271 /**
260 * Object-related communications 272 * Object-related communications
261 */ 273 */
262 274
263 public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) 275 public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall)
@@ -527,7 +539,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
527 protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) 539 protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle)
528 { 540 {
529 //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); 541 //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle);
530 542
531 if (action.Equals("release")) 543 if (action.Equals("release"))
532 m_localBackend.SendReleaseAgent(regionHandle, id, ""); 544 m_localBackend.SendReleaseAgent(regionHandle, id, "");
533 else 545 else
@@ -613,7 +625,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
613 extraStr = args["extra"].AsString(); 625 extraStr = args["extra"].AsString();
614 626
615 UUID regionID = m_localBackend.GetRegionID(regionhandle); 627 UUID regionID = m_localBackend.GetRegionID(regionhandle);
616 SceneObjectGroup sog = null; 628 SceneObjectGroup sog = null;
617 try 629 try
618 { 630 {
619 sog = SceneObjectSerializer.FromXml2Format(sogXmlStr); 631 sog = SceneObjectSerializer.FromXml2Format(sogXmlStr);
@@ -675,7 +687,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
675 responsedata["str_response_string"] = result.ToString(); 687 responsedata["str_response_string"] = result.ToString();
676 } 688 }
677 689
678 #endregion 690 #endregion
679 691
680 #region Misc 692 #region Misc
681 693
@@ -707,7 +719,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
707 UInt64.TryParse(parts[2], out regionHandle); 719 UInt64.TryParse(parts[2], out regionHandle);
708 if (parts.Length >= 4) 720 if (parts.Length >= 4)
709 action = parts[3]; 721 action = parts[3];
710 722
711 return true; 723 return true;
712 } 724 }
713 } 725 }
@@ -759,7 +771,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
759 } 771 }
760 772
761 773
762 #endregion Misc 774 #endregion Misc
763 775
764 protected class RegionToRegionClient : RegionClient 776 protected class RegionToRegionClient : RegionClient
765 { 777 {