aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Estate/EstateConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateConnector.cs (renamed from OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs)62
1 files changed, 36 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs b/OpenSim/Region/CoreModules/World/Estate/EstateConnector.cs
index 73e706c..8001c3c 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateConnector.cs
@@ -45,17 +45,22 @@ namespace OpenSim.Region.CoreModules.World.Estate
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 protected XEstateModule m_EstateModule; 48 protected EstateModule m_EstateModule;
49 private string token;
50 uint port = 0;
49 51
50 public EstateConnector(XEstateModule module) 52 public EstateConnector(EstateModule module, string _token, uint _port)
51 { 53 {
52 m_EstateModule = module; 54 m_EstateModule = module;
55 token = _token;
56 port = _port;
53 } 57 }
54 58
55 public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID) 59 public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID)
56 { 60 {
57 Dictionary<string, object> sendData = new Dictionary<string, object>(); 61 Dictionary<string, object> sendData = new Dictionary<string, object>();
58 sendData["METHOD"] = "teleport_home_one_user"; 62 sendData["METHOD"] = "teleport_home_one_user";
63 sendData["TOKEN"] = token;
59 64
60 sendData["EstateID"] = EstateID.ToString(); 65 sendData["EstateID"] = EstateID.ToString();
61 sendData["PreyID"] = PreyID.ToString(); 66 sendData["PreyID"] = PreyID.ToString();
@@ -67,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
67 { 72 {
68 Dictionary<string, object> sendData = new Dictionary<string, object>(); 73 Dictionary<string, object> sendData = new Dictionary<string, object>();
69 sendData["METHOD"] = "teleport_home_all_users"; 74 sendData["METHOD"] = "teleport_home_all_users";
75 sendData["TOKEN"] = token;
70 76
71 sendData["EstateID"] = EstateID.ToString(); 77 sendData["EstateID"] = EstateID.ToString();
72 78
@@ -77,6 +83,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
77 { 83 {
78 Dictionary<string, object> sendData = new Dictionary<string, object>(); 84 Dictionary<string, object> sendData = new Dictionary<string, object>();
79 sendData["METHOD"] = "update_covenant"; 85 sendData["METHOD"] = "update_covenant";
86 sendData["TOKEN"] = token;
80 87
81 sendData["CovenantID"] = CovenantID.ToString(); 88 sendData["CovenantID"] = CovenantID.ToString();
82 sendData["EstateID"] = EstateID.ToString(); 89 sendData["EstateID"] = EstateID.ToString();
@@ -99,6 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
99 { 106 {
100 Dictionary<string, object> sendData = new Dictionary<string, object>(); 107 Dictionary<string, object> sendData = new Dictionary<string, object>();
101 sendData["METHOD"] = "update_estate"; 108 sendData["METHOD"] = "update_estate";
109 sendData["TOKEN"] = token;
102 110
103 sendData["EstateID"] = EstateID.ToString(); 111 sendData["EstateID"] = EstateID.ToString();
104 112
@@ -119,6 +127,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
119 { 127 {
120 Dictionary<string, object> sendData = new Dictionary<string, object>(); 128 Dictionary<string, object> sendData = new Dictionary<string, object>();
121 sendData["METHOD"] = "estate_message"; 129 sendData["METHOD"] = "estate_message";
130 sendData["TOKEN"] = token;
122 131
123 sendData["EstateID"] = EstateID.ToString(); 132 sendData["EstateID"] = EstateID.ToString();
124 sendData["FromID"] = FromID.ToString(); 133 sendData["FromID"] = FromID.ToString();
@@ -132,47 +141,43 @@ namespace OpenSim.Region.CoreModules.World.Estate
132 { 141 {
133 List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID); 142 List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID);
134 143
135 UUID ScopeID = UUID.Zero; 144 // Don't send to the same instance twice
145 List<string> done = new List<string>();
136 146
137 // Handle local regions locally 147 // Handle local regions locally
138 //
139 lock (m_EstateModule.Scenes) 148 lock (m_EstateModule.Scenes)
140 { 149 {
141 foreach (Scene s in m_EstateModule.Scenes) 150 foreach (Scene s in m_EstateModule.Scenes)
142 { 151 {
143 if (regions.Contains(s.RegionInfo.RegionID)) 152 RegionInfo sreg = s.RegionInfo;
153 if (regions.Contains(sreg.RegionID))
144 { 154 {
145 // All regions in one estate are in the same scope. 155 string url = sreg.ExternalHostName + ":" + sreg.HttpPort;
146 // Use that scope. 156 regions.Remove(sreg.RegionID);
147 // 157 if(!done.Contains(url)) // we may have older regs with same url lost in dbs
148 ScopeID = s.RegionInfo.ScopeID; 158 done.Add(url);
149 regions.Remove(s.RegionInfo.RegionID);
150 } 159 }
151 } 160 }
152 } 161 }
153 162
154 // Our own region should always be in the above list. 163 if(regions.Count == 0)
155 // In a standalone this would not be true. But then, 164 return;
156 // Scope ID is not relevat there. Use first scope.
157 //
158 if (ScopeID == UUID.Zero)
159 ScopeID = m_EstateModule.Scenes[0].RegionInfo.ScopeID;
160 165
161 // Don't send to the same instance twice 166 Scene baseScene = m_EstateModule.Scenes[0];
162 // 167 UUID ScopeID = baseScene.RegionInfo.ScopeID;
163 List<string> done = new List<string>(); 168 IGridService gridService = baseScene.GridService;
169 if(gridService == null)
170 return;
164 171
165 // Send to remote regions 172 // Send to remote regions
166 //
167 foreach (UUID regionID in regions) 173 foreach (UUID regionID in regions)
168 { 174 {
169 GridRegion region = m_EstateModule.Scenes[0].GridService.GetRegionByUUID(ScopeID, regionID); 175 GridRegion region = gridService.GetRegionByUUID(ScopeID, regionID);
170 if (region != null) 176 if (region != null)
171 { 177 {
172 string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; 178 string url = region.ExternalHostName + ":" + region.HttpPort;
173 if (done.Contains(url)) 179 if(done.Contains(url))
174 continue; 180 continue;
175
176 Call(region, sendData); 181 Call(region, sendData);
177 done.Add(url); 182 done.Add(url);
178 } 183 }
@@ -185,9 +190,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
185 // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString); 190 // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString);
186 try 191 try
187 { 192 {
188 string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; 193 string url = "";
194 if(port != 0)
195 url = "http://" + region.ExternalHostName + ":" + port + "/";
196 else
197 url = region.ServerURI;
198
189 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 199 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
190 url + "/estate", 200 url + "estate",
191 reqString); 201 reqString);
192 if (reply != string.Empty) 202 if (reply != string.Empty)
193 { 203 {