aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2010-01-29 18:59:41 -0800
committerDiva Canto2010-01-29 18:59:41 -0800
commit5001f61c08fea2ebfcb2590be69073d04d129d70 (patch)
tree08a0470b0b566f814209bfb803fbcc0959333bcd /OpenSim/Region/CoreModules
parentWorks for grid login. (diff)
downloadopensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.zip
opensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.gz
opensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.bz2
opensim-SC-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.xz
* HGGridConnector is no longer necessary.
* Handle logout properly. This needed an addition to IClientAPI, because of how the logout packet is currently being handled -- the agent is being removed from the scene before the different event handlers are executed, which is broken.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs257
4 files changed, 20 insertions, 275 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ee6cb04..53de269 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -268,7 +268,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
268 if (sp.ParentID != (uint)0) 268 if (sp.ParentID != (uint)0)
269 sp.StandUp(); 269 sp.StandUp();
270 270
271 m_log.Debug("XXX HERE 1");
272 if (!sp.ValidateAttachments()) 271 if (!sp.ValidateAttachments())
273 { 272 {
274 sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); 273 sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
@@ -351,7 +350,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
351 // ES makes the client send a UseCircuitCode message to the destination, 350 // ES makes the client send a UseCircuitCode message to the destination,
352 // which triggers a bunch of things there. 351 // which triggers a bunch of things there.
353 // So let's wait 352 // So let's wait
354 Thread.Sleep(2000); 353 Thread.Sleep(200);
355 354
356 eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath); 355 eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
357 356
@@ -428,13 +427,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
428 return; 427 return;
429 } 428 }
430 429
431 KillEntity(sp.Scene, sp.LocalId);
432
433 sp.MakeChildAgent();
434 430
435 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 431 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
436 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 432 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
437 433
434 KillEntity(sp.Scene, sp.LocalId);
435
436 sp.MakeChildAgent();
438 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 437 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
439 438
440 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 439 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index fbf8be9..28593fc 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -81,16 +81,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
81 if (m_Enabled) 81 if (m_Enabled)
82 { 82 {
83 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 83 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
84 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(OnNewClient);
85 } 84 }
86 } 85 }
87 86
88 protected override void OnNewClient(IClientAPI client) 87 protected override void OnNewClient(IClientAPI client)
89 { 88 {
90 base.OnNewClient(client); 89 client.OnTeleportHomeRequest += TeleportHome;
91 client.OnLogout += new Action<IClientAPI>(OnLogout); 90 client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
92 } 91 }
93 92
93
94 public override void RegionLoaded(Scene scene) 94 public override void RegionLoaded(Scene scene)
95 { 95 {
96 base.RegionLoaded(scene); 96 base.RegionLoaded(scene);
@@ -234,18 +234,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
234 return false; 234 return false;
235 } 235 }
236 236
237 void OnLogout(IClientAPI obj) 237 void OnConnectionClosed(IClientAPI obj)
238 { 238 {
239 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: client {0} logged out in {1}", obj.AgentId, obj.Scene.RegionInfo.RegionName); 239 if (obj.IsLoggingOut)
240 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
241
242 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
243 { 240 {
244 string url = aCircuit.ServiceURLs["HomeURI"].ToString(); 241 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
245 IUserAgentService security = new UserAgentServiceConnector(url);
246 security.LogoutAgent(obj.AgentId, obj.SessionId);
247 }
248 242
243 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
244 {
245 string url = aCircuit.ServiceURLs["HomeURI"].ToString();
246 IUserAgentService security = new UserAgentServiceConnector(url);
247 security.LogoutAgent(obj.AgentId, obj.SessionId);
248 //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url);
249 }
250 else
251 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId);
252 }
249 } 253 }
250 254
251 #endregion 255 #endregion
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 0e3739a..e10fa60 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -50,7 +50,6 @@
50 <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" /> 50 <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" />
51 <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" /> 51 <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" />
52 <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" /> 52 <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" />
53 <RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" />
54 <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" /> 53 <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" />
55 <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> 54 <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" />
56 <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" /> 55 <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" />
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
deleted file mode 100644
index 67eae87..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using System.Xml;
33
34
35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.Framework.Scenes.Hypergrid;
39using OpenSim.Services.Interfaces;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
42using OpenSim.Server.Base;
43using OpenSim.Framework.Console;
44
45using OpenMetaverse;
46using log4net;
47using Nini.Config;
48
49namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
50{
51 public class HGGridConnector : ISharedRegionModule, IGridService
52 {
53 private static readonly ILog m_log =
54 LogManager.GetLogger(
55 MethodBase.GetCurrentMethod().DeclaringType);
56
57 private bool m_Enabled = false;
58 private bool m_Initialized = false;
59
60 private Scene m_aScene;
61 private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
62
63 private IGridService m_GridServiceConnector;
64
65 #region ISharedRegionModule
66
67 public Type ReplaceableInterface
68 {
69 get { return null; }
70 }
71
72 public string Name
73 {
74 get { return "HGGridServicesConnector"; }
75 }
76
77 public void Initialise(IConfigSource source)
78 {
79 IConfig moduleConfig = source.Configs["Modules"];
80 if (moduleConfig != null)
81 {
82 string name = moduleConfig.GetString("GridServices", "");
83 if (name == Name)
84 {
85 IConfig gridConfig = source.Configs["GridService"];
86 if (gridConfig == null)
87 {
88 m_log.Error("[HGGRID CONNECTOR]: GridService missing from OpenSim.ini");
89 return;
90 }
91
92
93 InitialiseConnectorModule(source);
94
95 m_Enabled = true;
96 m_log.Info("[HGGRID CONNECTOR]: HG grid enabled");
97 }
98 }
99 }
100
101 private void InitialiseConnectorModule(IConfigSource source)
102 {
103 IConfig gridConfig = source.Configs["GridService"];
104 if (gridConfig == null)
105 {
106 m_log.Error("[HGGRID CONNECTOR]: GridService missing from OpenSim.ini");
107 throw new Exception("Grid connector init error");
108 }
109
110 string module = gridConfig.GetString("GridServiceConnectorModule", String.Empty);
111 if (module == String.Empty)
112 {
113 m_log.Error("[HGGRID CONNECTOR]: No GridServiceConnectorModule named in section GridService");
114 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
115 }
116
117 Object[] args = new Object[] { source };
118 m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args);
119
120 }
121
122 public void PostInitialise()
123 {
124 if (m_Enabled)
125 ((ISharedRegionModule)m_GridServiceConnector).PostInitialise();
126 }
127
128 public void Close()
129 {
130 }
131
132 public void AddRegion(Scene scene)
133 {
134 if (!m_Enabled)
135 return;
136
137 m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
138 scene.RegisterModuleInterface<IGridService>(this);
139
140 ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
141
142 }
143
144 public void RemoveRegion(Scene scene)
145 {
146 if (m_Enabled)
147 {
148 m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
149 scene.UnregisterModuleInterface<IGridService>(this);
150 ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene);
151 }
152 }
153
154 public void RegionLoaded(Scene scene)
155 {
156 if (!m_Enabled)
157 return;
158
159 if (!m_Initialized)
160 {
161 m_aScene = scene;
162
163 m_Initialized = true;
164 }
165 }
166
167 #endregion
168
169 #region IGridService
170
171 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
172 {
173 return m_GridServiceConnector.RegisterRegion(scopeID, regionInfo);
174 }
175
176 public bool DeregisterRegion(UUID regionID)
177 {
178 return m_GridServiceConnector.DeregisterRegion(regionID);
179 }
180
181 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
182 {
183 // No serving neighbours on hyperliked regions.
184 // Just the regular regions.
185 return m_GridServiceConnector.GetNeighbours(scopeID, regionID);
186 }
187
188 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
189 {
190 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
191 //if (region != null)
192 // return region;
193
194 //region = m_HypergridService.GetRegionByUUID(regionID);
195
196 //return region;
197 }
198
199 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
200 {
201 int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize;
202 int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize;
203
204 GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y);
205 //if (region != null)
206 // return region;
207
208 //region = m_HypergridService.GetRegionByPosition(snapX, snapY);
209
210 return region;
211 }
212
213 public GridRegion GetRegionByName(UUID scopeID, string regionName)
214 {
215 // Try normal grid first
216 GridRegion region = m_GridServiceConnector.GetRegionByName(scopeID, regionName);
217 if (region != null)
218 return region;
219
220 //region = m_HypergridService.GetRegionByName(regionName);
221
222 return region;
223 }
224
225 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
226 {
227 if (name == string.Empty)
228 return new List<GridRegion>();
229
230 return m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber);
231 }
232
233 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
234 {
235 return m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
236 }
237
238 public List<GridRegion> GetDefaultRegions(UUID scopeID)
239 {
240 return m_GridServiceConnector.GetDefaultRegions(scopeID);
241 }
242
243 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
244 {
245 return m_GridServiceConnector.GetFallbackRegions(scopeID, x, y);
246 }
247
248 public int GetRegionFlags(UUID scopeID, UUID regionID)
249 {
250 return m_GridServiceConnector.GetRegionFlags(scopeID, regionID);
251 }
252
253 #endregion
254
255
256 }
257}