aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs60
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs43
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs19
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs86
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs2
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs169
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
17 files changed, 360 insertions, 129 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 825ab81..b6b7996 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -274,7 +274,7 @@ namespace OpenSim.Framework
274 get { return m_id; } 274 get { return m_id; }
275 set { m_id = value; } 275 set { m_id = value; }
276 } 276 }
277 public ulong RegionHandle; 277 public UUID RegionID;
278 public uint CircuitCode; 278 public uint CircuitCode;
279 public UUID SessionID; 279 public UUID SessionID;
280 280
@@ -321,7 +321,7 @@ namespace OpenSim.Framework
321 OSDMap args = new OSDMap(); 321 OSDMap args = new OSDMap();
322 args["message_type"] = OSD.FromString("AgentData"); 322 args["message_type"] = OSD.FromString("AgentData");
323 323
324 args["region_handle"] = OSD.FromString(RegionHandle.ToString()); 324 args["region_id"] = OSD.FromString(RegionID.ToString());
325 args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); 325 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
326 args["agent_uuid"] = OSD.FromUUID(AgentID); 326 args["agent_uuid"] = OSD.FromUUID(AgentID);
327 args["session_uuid"] = OSD.FromUUID(SessionID); 327 args["session_uuid"] = OSD.FromUUID(SessionID);
@@ -414,8 +414,8 @@ namespace OpenSim.Framework
414 /// <param name="hash"></param> 414 /// <param name="hash"></param>
415 public virtual void Unpack(OSDMap args) 415 public virtual void Unpack(OSDMap args)
416 { 416 {
417 if (args.ContainsKey("region_handle")) 417 if (args.ContainsKey("region_id"))
418 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); 418 UUID.TryParse(args["region_id"].AsString(), out RegionID);
419 419
420 if (args["circuit_code"] != null) 420 if (args["circuit_code"] != null)
421 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); 421 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
@@ -572,7 +572,7 @@ namespace OpenSim.Framework
572 { 572 {
573 System.Console.WriteLine("------------ AgentData ------------"); 573 System.Console.WriteLine("------------ AgentData ------------");
574 System.Console.WriteLine("UUID: " + AgentID); 574 System.Console.WriteLine("UUID: " + AgentID);
575 System.Console.WriteLine("Region: " + RegionHandle); 575 System.Console.WriteLine("Region: " + RegionID);
576 System.Console.WriteLine("Position: " + Position); 576 System.Console.WriteLine("Position: " + Position);
577 } 577 }
578 } 578 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 2d4b421..c0d3f31 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -37,6 +37,8 @@ using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion; 39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
41using OpenSim.Services.Interfaces;
40 42
41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 43namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
42{ 44{
@@ -46,10 +48,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
46 48
47 private bool m_Enabled = false; 49 private bool m_Enabled = false;
48 protected List<Scene> m_Scenes = new List<Scene>(); 50 protected List<Scene> m_Scenes = new List<Scene>();
49 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); 51 protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
50 52
51 public event UndeliveredMessage OnUndeliveredMessage; 53 public event UndeliveredMessage OnUndeliveredMessage;
52 54
55 private IPresenceService m_PresenceService;
56 protected IPresenceService PresenceService
57 {
58 get
59 {
60 if (m_PresenceService == null)
61 m_PresenceService = m_Scenes[0].RequestModuleInterface<IPresenceService>();
62 return m_PresenceService;
63 }
64 }
65
53 public virtual void Initialise(IConfigSource config) 66 public virtual void Initialise(IConfigSource config)
54 { 67 {
55 IConfig cnf = config.Configs["Messaging"]; 68 IConfig cnf = config.Configs["Messaging"];
@@ -416,7 +429,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
416 /// <summary> 429 /// <summary>
417 /// delegate for sending a grid instant message asynchronously 430 /// delegate for sending a grid instant message asynchronously
418 /// </summary> 431 /// </summary>
419 public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle); 432 public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID);
420 433
421 protected virtual void GridInstantMessageCompleted(IAsyncResult iar) 434 protected virtual void GridInstantMessageCompleted(IAsyncResult iar)
422 { 435 {
@@ -430,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
430 { 443 {
431 GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; 444 GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync;
432 445
433 d.BeginInvoke(im, result, 0, GridInstantMessageCompleted, d); 446 d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d);
434 } 447 }
435 448
436 /// <summary> 449 /// <summary>
@@ -445,11 +458,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
445 /// Pass in 0 the first time this method is called. It will be called recursively with the last 458 /// Pass in 0 the first time this method is called. It will be called recursively with the last
446 /// regionhandle tried 459 /// regionhandle tried
447 /// </param> 460 /// </param>
448 protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle) 461 protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID)
449 { 462 {
450 UUID toAgentID = new UUID(im.toAgentID); 463 UUID toAgentID = new UUID(im.toAgentID);
451 464
452 UserAgentData upd = null; 465 PresenceInfo upd = null;
453 466
454 bool lookupAgent = false; 467 bool lookupAgent = false;
455 468
@@ -457,13 +470,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
457 { 470 {
458 if (m_UserRegionMap.ContainsKey(toAgentID)) 471 if (m_UserRegionMap.ContainsKey(toAgentID))
459 { 472 {
460 upd = new UserAgentData(); 473 upd = new PresenceInfo();
461 upd.AgentOnline = true; 474 upd.Online = true;
462 upd.Handle = m_UserRegionMap[toAgentID]; 475 upd.RegionID = m_UserRegionMap[toAgentID];
463 476
464 // We need to compare the current regionhandle with the previous region handle 477 // We need to compare the current regionhandle with the previous region handle
465 // or the recursive loop will never end because it will never try to lookup the agent again 478 // or the recursive loop will never end because it will never try to lookup the agent again
466 if (prevRegionHandle == upd.Handle) 479 if (prevRegionID == upd.RegionID)
467 { 480 {
468 lookupAgent = true; 481 lookupAgent = true;
469 } 482 }
@@ -479,14 +492,23 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
479 if (lookupAgent) 492 if (lookupAgent)
480 { 493 {
481 // Non-cached user agent lookup. 494 // Non-cached user agent lookup.
482 upd = m_Scenes[0].CommsManager.UserService.GetAgentByUUID(toAgentID); 495 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
496 if (presences != null)
497 {
498 foreach (PresenceInfo p in presences)
499 if (p.Online)
500 {
501 upd = presences[0];
502 break;
503 }
504 }
483 505
484 if (upd != null) 506 if (upd != null)
485 { 507 {
486 // check if we've tried this before.. 508 // check if we've tried this before..
487 // This is one way to end the recursive loop 509 // This is one way to end the recursive loop
488 // 510 //
489 if (upd.Handle == prevRegionHandle) 511 if (upd.RegionID == prevRegionID)
490 { 512 {
491 m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); 513 m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
492 HandleUndeliveredMessage(im, result); 514 HandleUndeliveredMessage(im, result);
@@ -503,12 +525,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
503 525
504 if (upd != null) 526 if (upd != null)
505 { 527 {
506 if (upd.AgentOnline) 528 if (upd.Online)
507 { 529 {
508 uint x = 0, y = 0; 530 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
509 Utils.LongToUInts(upd.Handle, out x, out y); 531 upd.RegionID);
510 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByPosition(m_Scenes[0].RegionInfo.ScopeID,
511 (int)x, (int)y);
512 if (reginfo != null) 532 if (reginfo != null)
513 { 533 {
514 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); 534 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
@@ -524,11 +544,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
524 { 544 {
525 if (m_UserRegionMap.ContainsKey(toAgentID)) 545 if (m_UserRegionMap.ContainsKey(toAgentID))
526 { 546 {
527 m_UserRegionMap[toAgentID] = upd.Handle; 547 m_UserRegionMap[toAgentID] = upd.RegionID;
528 } 548 }
529 else 549 else
530 { 550 {
531 m_UserRegionMap.Add(toAgentID, upd.Handle); 551 m_UserRegionMap.Add(toAgentID, upd.RegionID);
532 } 552 }
533 } 553 }
534 result(true); 554 result(true);
@@ -543,12 +563,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
543 563
544 // This is recursive!!!!! 564 // This is recursive!!!!!
545 SendGridInstantMessageViaXMLRPCAsync(im, result, 565 SendGridInstantMessageViaXMLRPCAsync(im, result,
546 upd.Handle); 566 upd.RegionID);
547 } 567 }
548 } 568 }
549 else 569 else
550 { 570 {
551 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.Handle); 571 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
552 HandleUndeliveredMessage(im, result); 572 HandleUndeliveredMessage(im, result);
553 } 573 }
554 } 574 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index ecd60bd..6da43a8 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -335,7 +335,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
335 335
336 try 336 try
337 { 337 {
338 if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass)) 338 if (m_aScene.AuthenticationService.Authenticate(userInfo.UserProfile.ID, pass, 1) != string.Empty)
339 { 339 {
340 return userInfo; 340 return userInfo;
341 } 341 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
index 8cf58c6..718ee2f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
110 public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID) 110 public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID)
111 { 111 {
112 // FIXME: finish adding fields such as url, masking, etc. 112 // FIXME: finish adding fields such as url, masking, etc.
113 UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID); 113 UserProfileData profile = null; // m_scene.CommsManager.UserService.GetUserProfile(avatarID);
114 if (null != profile) 114 if (null != profile)
115 { 115 {
116 Byte[] charterMember; 116 Byte[] charterMember;
@@ -143,26 +143,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
143 143
144 public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile) 144 public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile)
145 { 145 {
146 UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID); 146 return;
147 147 //UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID);
148 // if it's the profile of the user requesting the update, then we change only a few things. 148
149 if (remoteClient.AgentId.CompareTo(Profile.ID) == 0) 149 //// if it's the profile of the user requesting the update, then we change only a few things.
150 { 150 //if (remoteClient.AgentId.CompareTo(Profile.ID) == 0)
151 Profile.Image = newProfile.Image; 151 //{
152 Profile.FirstLifeImage = newProfile.FirstLifeImage; 152 // Profile.Image = newProfile.Image;
153 Profile.AboutText = newProfile.AboutText; 153 // Profile.FirstLifeImage = newProfile.FirstLifeImage;
154 Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; 154 // Profile.AboutText = newProfile.AboutText;
155 Profile.ProfileUrl = newProfile.ProfileUrl; 155 // Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText;
156 } 156 // Profile.ProfileUrl = newProfile.ProfileUrl;
157 else 157 //}
158 { 158 //else
159 return; 159 //{
160 } 160 // return;
161 161 //}
162 if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile)) 162
163 { 163 //if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile))
164 RequestAvatarProperty(remoteClient, newProfile.ID); 164 //{
165 } 165 // RequestAvatarProperty(remoteClient, newProfile.ID);
166 //}
166 } 167 }
167 } 168 }
168} 169}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
index 68499f3..01a2615 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs
@@ -139,9 +139,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
139 139
140 if (scene != null) 140 if (scene != null)
141 { 141 {
142 UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID)); 142 UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, userID);
143 isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName, 143 isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName,
144 profile.Email, scene.RegionInfo.RegionName, regionID, out message); 144 account.Email, scene.RegionInfo.RegionName, regionID, out message);
145 } 145 }
146 else 146 else
147 { 147 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs
index e8e140a..6c69570 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
59 59
60 public string Name 60 public string Name
61 { 61 {
62 get { return "RemotePresenceServiceConnector"; } 62 get { return "RemotePresenceServicesConnector"; }
63 } 63 }
64 64
65 public void Initialise(IConfigSource source) 65 public void Initialise(IConfigSource source)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 074bfb5..c6c6af0 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -172,12 +172,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
172 { 172 {
173 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 173 if (s.RegionInfo.RegionHandle == destination.RegionHandle)
174 { 174 {
175// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); 175 m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
176 return s.NewUserConnection(aCircuit, teleportFlags, out reason); 176 return s.NewUserConnection(aCircuit, teleportFlags, out reason);
177 } 177 }
178 } 178 }
179 179
180// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); 180 m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", destination.RegionName);
181 reason = "Did not find region " + destination.RegionName; 181 reason = "Did not find region " + destination.RegionName;
182 return false; 182 return false;
183 } 183 }
@@ -241,14 +241,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
241 return false; 241 return false;
242 } 242 }
243 243
244 public bool ReleaseAgent(GridRegion destination, UUID id, string uri) 244 public bool ReleaseAgent(UUID origin, UUID id, string uri)
245 { 245 {
246 if (destination == null)
247 return false;
248
249 foreach (Scene s in m_sceneList) 246 foreach (Scene s in m_sceneList)
250 { 247 {
251 if (s.RegionInfo.RegionHandle == destination.RegionHandle) 248 if (s.RegionInfo.RegionID == origin)
252 { 249 {
253 //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); 250 //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
254 return s.IncomingReleaseAgent(id); 251 return s.IncomingReleaseAgent(id);
@@ -334,6 +331,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
334 return false; 331 return false;
335 } 332 }
336 333
334 public bool IsLocalRegion(UUID id)
335 {
336 foreach (Scene s in m_sceneList)
337 if (s.RegionInfo.RegionID == id)
338 return true;
339 return false;
340 }
341
337 #endregion 342 #endregion
338 } 343 }
339} 344}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index c9cc368..f485cd1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -245,18 +245,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
245 245
246 } 246 }
247 247
248 public bool ReleaseAgent(GridRegion destination, UUID id, string uri) 248 public bool ReleaseAgent(UUID origin, UUID id, string uri)
249 { 249 {
250 if (destination == null)
251 return false;
252
253 // Try local first 250 // Try local first
254 if (m_localBackend.ReleaseAgent(destination, id, uri)) 251 if (m_localBackend.ReleaseAgent(origin, id, uri))
255 return true; 252 return true;
256 253
257 // else do the remote thing 254 // else do the remote thing
258 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 255 if (!m_localBackend.IsLocalRegion(origin))
259 return m_remoteConnector.ReleaseAgent(destination, id, uri); 256 return m_remoteConnector.ReleaseAgent(origin, id, uri);
260 257
261 return false; 258 return false;
262 } 259 }
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 416826c..f64a7a0 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -202,8 +202,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
202 202
203 string reason = String.Empty; 203 string reason = String.Empty;
204 204
205 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) 205 if (!m_scene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
206 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
207 { 206 {
208 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", 207 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
209 reason)); 208 reason));
@@ -282,9 +281,9 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
282 avatar.CopyTo(agent); 281 avatar.CopyTo(agent);
283 agent.Position = position; 282 agent.Position = position;
284 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + 283 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
285 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; 284 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionID.ToString() + "/release/";
286 285
287 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); 286 m_scene.SimulationService.UpdateAgent(reg, agent);
288 287
289 m_log.DebugFormat( 288 m_log.DebugFormat(
290 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID); 289 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID);
@@ -322,8 +321,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
322 avatar.Scene.InformClientOfNeighbours(avatar); 321 avatar.Scene.InformClientOfNeighbours(avatar);
323 322
324 // Finally, kill the agent we just created at the destination. 323 // Finally, kill the agent we just created at the destination.
325 m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID); 324 m_scene.SimulationService.CloseAgent(reg, avatar.UUID);
326
327 return; 325 return;
328 } 326 }
329 327
@@ -336,7 +334,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
336 avatar.MakeChildAgent(); 334 avatar.MakeChildAgent();
337 335
338 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 336 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
339 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 337 avatar.CrossAttachmentsIntoNewRegion(reg, true);
340 338
341 339
342 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 340 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a14c853..1c5c247 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1163,15 +1163,21 @@ namespace OpenSim.Region.Framework.Scenes
1163 1163
1164 private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) 1164 private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
1165 { 1165 {
1166 if (folder == null)
1167 return;
1168
1166 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); 1169 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName);
1167 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); 1170 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
1168 InventoryFolderBase containingFolder = new InventoryFolderBase(); 1171 InventoryFolderBase containingFolder = new InventoryFolderBase();
1169 containingFolder.ID = folder.ID; 1172 containingFolder.ID = folder.ID;
1170 containingFolder.Owner = client.AgentId; 1173 containingFolder.Owner = client.AgentId;
1171 containingFolder = InventoryService.GetFolder(containingFolder); 1174 containingFolder = InventoryService.GetFolder(containingFolder);
1172 int version = containingFolder.Version; 1175 if (containingFolder != null)
1176 {
1177 int version = containingFolder.Version;
1173 1178
1174 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems); 1179 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems);
1180 }
1175 } 1181 }
1176 1182
1177 /// <summary> 1183 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 20c0622..d8874b2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -253,6 +253,49 @@ namespace OpenSim.Region.Framework.Scenes
253 } 253 }
254 } 254 }
255 255
256 protected ISimulationService m_simulationService;
257 public ISimulationService SimulationService
258 {
259 get
260 {
261 if (m_simulationService == null)
262 m_simulationService = RequestModuleInterface<ISimulationService>();
263 return m_simulationService;
264 }
265 }
266
267 protected IAuthenticationService m_AuthenticationService;
268 public IAuthenticationService AuthenticationService
269 {
270 get
271 {
272 if (m_AuthenticationService == null)
273 m_AuthenticationService = RequestModuleInterface<IAuthenticationService>();
274 return m_AuthenticationService;
275 }
276 }
277
278 protected IPresenceService m_PresenceService;
279 public IPresenceService PresenceService
280 {
281 get
282 {
283 if (m_PresenceService == null)
284 m_PresenceService = RequestModuleInterface<IPresenceService>();
285 return m_PresenceService;
286 }
287 }
288 protected IUserAccountService m_UserAccountService;
289 public IUserAccountService UserAccountService
290 {
291 get
292 {
293 if (m_UserAccountService == null)
294 m_UserAccountService = RequestModuleInterface<IUserAccountService>();
295 return m_UserAccountService;
296 }
297 }
298
256 protected IXMLRPC m_xmlrpcModule; 299 protected IXMLRPC m_xmlrpcModule;
257 protected IWorldComm m_worldCommModule; 300 protected IWorldComm m_worldCommModule;
258 protected IAvatarFactory m_AvatarFactory; 301 protected IAvatarFactory m_AvatarFactory;
@@ -262,8 +305,6 @@ namespace OpenSim.Region.Framework.Scenes
262 } 305 }
263 protected IConfigSource m_config; 306 protected IConfigSource m_config;
264 protected IRegionSerialiserModule m_serialiser; 307 protected IRegionSerialiserModule m_serialiser;
265 protected IInterregionCommsOut m_interregionCommsOut;
266 protected IInterregionCommsIn m_interregionCommsIn;
267 protected IDialogModule m_dialogModule; 308 protected IDialogModule m_dialogModule;
268 protected ITeleportModule m_teleportModule; 309 protected ITeleportModule m_teleportModule;
269 310
@@ -1136,8 +1177,6 @@ namespace OpenSim.Region.Framework.Scenes
1136 XferManager = RequestModuleInterface<IXfer>(); 1177 XferManager = RequestModuleInterface<IXfer>();
1137 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); 1178 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
1138 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1179 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1139 m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
1140 m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
1141 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1180 m_dialogModule = RequestModuleInterface<IDialogModule>();
1142 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1181 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1143 m_teleportModule = RequestModuleInterface<ITeleportModule>(); 1182 m_teleportModule = RequestModuleInterface<ITeleportModule>();
@@ -2155,7 +2194,10 @@ namespace OpenSim.Region.Framework.Scenes
2155 grp.OffsetForNewRegion(pos); 2194 grp.OffsetForNewRegion(pos);
2156 2195
2157 // If we fail to cross the border, then reset the position of the scene object on that border. 2196 // If we fail to cross the border, then reset the position of the scene object on that border.
2158 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent)) 2197 uint x = 0, y = 0;
2198 Utils.LongToUInts(newRegionHandle, out x, out y);
2199 GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2200 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
2159 { 2201 {
2160 grp.OffsetForNewRegion(oldGroupPosition); 2202 grp.OffsetForNewRegion(oldGroupPosition);
2161 grp.ScheduleGroupForFullUpdate(); 2203 grp.ScheduleGroupForFullUpdate();
@@ -2351,7 +2393,7 @@ namespace OpenSim.Region.Framework.Scenes
2351 /// true if the crossing itself was successful, false on failure 2393 /// true if the crossing itself was successful, false on failure
2352 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 2394 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
2353 /// </returns> 2395 /// </returns>
2354 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) 2396 public bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
2355 { 2397 {
2356 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); 2398 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
2357 2399
@@ -2359,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes
2359 grp.RootPart.UpdateFlag = 0; 2401 grp.RootPart.UpdateFlag = 0;
2360 //int primcrossingXMLmethod = 0; 2402 //int primcrossingXMLmethod = 0;
2361 2403
2362 if (newRegionHandle != 0) 2404 if (destination != null)
2363 { 2405 {
2364 //string objectState = grp.GetStateSnapshot(); 2406 //string objectState = grp.GetStateSnapshot();
2365 2407
@@ -2372,9 +2414,11 @@ namespace OpenSim.Region.Framework.Scenes
2372 // newRegionHandle, grp.UUID, objectState, 100); 2414 // newRegionHandle, grp.UUID, objectState, 100);
2373 //} 2415 //}
2374 2416
2375 // And the new channel... 2417 //// And the new channel...
2376 if (m_interregionCommsOut != null) 2418 //if (m_interregionCommsOut != null)
2377 successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 2419 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
2420 if (m_simulationService != null)
2421 successYN = m_simulationService.CreateObject(destination, grp, true);
2378 2422
2379 if (successYN) 2423 if (successYN)
2380 { 2424 {
@@ -2405,7 +2449,7 @@ namespace OpenSim.Region.Framework.Scenes
2405 } 2449 }
2406 else 2450 else
2407 { 2451 {
2408 m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); 2452 m_log.Error("[INTERREGION]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
2409 } 2453 }
2410 2454
2411 return successYN; 2455 return successYN;
@@ -2598,10 +2642,9 @@ namespace OpenSim.Region.Framework.Scenes
2598 m_log.Debug(logMsg); 2642 m_log.Debug(logMsg);
2599 */ 2643 */
2600 2644
2601 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2645 //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2602 2646
2603 ScenePresence sp = CreateAndAddScenePresence(client); 2647 ScenePresence sp = CreateAndAddScenePresence(client);
2604
2605 // HERE!!! Do the initial attachments right here 2648 // HERE!!! Do the initial attachments right here
2606 // first agent upon login is a root agent by design. 2649 // first agent upon login is a root agent by design.
2607 // All other AddNewClient calls find aCircuit.child to be true 2650 // All other AddNewClient calls find aCircuit.child to be true
@@ -2614,6 +2657,7 @@ namespace OpenSim.Region.Framework.Scenes
2614 2657
2615 m_LastLogin = Util.EnvironmentTickCount(); 2658 m_LastLogin = Util.EnvironmentTickCount();
2616 EventManager.TriggerOnNewClient(client); 2659 EventManager.TriggerOnNewClient(client);
2660
2617 } 2661 }
2618 2662
2619 2663
@@ -3289,14 +3333,6 @@ namespace OpenSim.Region.Framework.Scenes
3289 m_sceneGridService.KiPrimitive += SendKillObject; 3333 m_sceneGridService.KiPrimitive += SendKillObject;
3290 m_sceneGridService.OnGetLandData += GetLandData; 3334 m_sceneGridService.OnGetLandData += GetLandData;
3291 3335
3292 if (m_interregionCommsIn != null)
3293 {
3294 m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
3295 m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3296 }
3297 else
3298 m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
3299
3300 } 3336 }
3301 3337
3302 /// <summary> 3338 /// <summary>
@@ -3314,9 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes
3314 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3350 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
3315 m_sceneGridService.OnGetLandData -= GetLandData; 3351 m_sceneGridService.OnGetLandData -= GetLandData;
3316 3352
3317 if (m_interregionCommsIn != null)
3318 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3319
3320 // this does nothing; should be removed 3353 // this does nothing; should be removed
3321 m_sceneGridService.Close(); 3354 m_sceneGridService.Close();
3322 3355
@@ -3758,9 +3791,10 @@ namespace OpenSim.Region.Framework.Scenes
3758 return m_sceneGridService.ReleaseAgent(id); 3791 return m_sceneGridService.ReleaseAgent(id);
3759 } 3792 }
3760 3793
3761 public void SendReleaseAgent(ulong regionHandle, UUID id, string uri) 3794 public void SendReleaseAgent(UUID origin, UUID id, string uri)
3762 { 3795 {
3763 m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri); 3796 //m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
3797 m_simulationService.ReleaseAgent(origin, id, uri);
3764 } 3798 }
3765 3799
3766 /// <summary> 3800 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index f49d072..f612d17 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Region.Framework.Scenes
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 protected CommunicationsManager m_commsProvider; 59 protected CommunicationsManager m_commsProvider;
60 protected IInterregionCommsOut m_interregionCommsOut;
61 protected RegionInfo m_regionInfo; 60 protected RegionInfo m_regionInfo;
62 protected Scene m_scene; 61 protected Scene m_scene;
63 62
@@ -135,7 +134,6 @@ namespace OpenSim.Region.Framework.Scenes
135 { 134 {
136 m_scene = s; 135 m_scene = s;
137 m_regionInfo = s.RegionInfo; 136 m_regionInfo = s.RegionInfo;
138 m_interregionCommsOut = m_scene.RequestModuleInterface<IInterregionCommsOut>();
139 } 137 }
140 138
141 /// <summary> 139 /// <summary>
@@ -255,6 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
255 { 253 {
256 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; 254 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
257 icon.EndInvoke(iar); 255 icon.EndInvoke(iar);
256 m_log.WarnFormat(" --> InformClientOfNeighbourCompleted");
258 } 257 }
259 258
260 /// <summary> 259 /// <summary>
@@ -285,8 +284,8 @@ namespace OpenSim.Region.Framework.Scenes
285 284
286 string reason = String.Empty; 285 string reason = String.Empty;
287 286
288 287
289 bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason); 288 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, 0, out reason); // m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
290 289
291 if (regionAccepted && newAgent) 290 if (regionAccepted && newAgent)
292 { 291 {
@@ -460,6 +459,7 @@ namespace OpenSim.Region.Framework.Scenes
460 int count = 0; 459 int count = 0;
461 foreach (GridRegion neighbour in neighbours) 460 foreach (GridRegion neighbour in neighbours)
462 { 461 {
462 m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName);
463 // Don't do it if there's already an agent in that region 463 // Don't do it if there's already an agent in that region
464 if (newRegions.Contains(neighbour.RegionHandle)) 464 if (newRegions.Contains(neighbour.RegionHandle))
465 newAgent = true; 465 newAgent = true;
@@ -600,7 +600,10 @@ namespace OpenSim.Region.Framework.Scenes
600 try 600 try
601 { 601 {
602 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); 602 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
603 m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData); 603 uint x = 0, y = 0;
604 Utils.LongToUInts(regionHandle, out x, out y);
605 GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
606 m_scene.SimulationService.UpdateAgent(destination, cAgentData);
604 } 607 }
605 catch 608 catch
606 { 609 {
@@ -660,7 +663,10 @@ namespace OpenSim.Region.Framework.Scenes
660 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 663 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
661 664
662 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); 665 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
663 m_interregionCommsOut.SendCloseAgent(regionHandle, agentID); 666 uint x = 0, y = 0;
667 Utils.LongToUInts(regionHandle, out x, out y);
668 GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
669 m_scene.SimulationService.CloseAgent(destination, agentID);
664 } 670 }
665 671
666 private void SendCloseChildAgentCompleted(IAsyncResult iar) 672 private void SendCloseChildAgentCompleted(IAsyncResult iar)
@@ -810,7 +816,7 @@ namespace OpenSim.Region.Framework.Scenes
810 816
811 // Let's create an agent there if one doesn't exist yet. 817 // Let's create an agent there if one doesn't exist yet.
812 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) 818 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
813 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason)) 819 if (!m_scene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
814 { 820 {
815 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", 821 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
816 reason)); 822 reason));
@@ -896,9 +902,9 @@ namespace OpenSim.Region.Framework.Scenes
896 avatar.CopyTo(agent); 902 avatar.CopyTo(agent);
897 agent.Position = position; 903 agent.Position = position;
898 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + 904 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
899 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; 905 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionID.ToString() + "/release/";
900 906
901 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); 907 m_scene.SimulationService.UpdateAgent(reg, agent);
902 908
903 m_log.DebugFormat( 909 m_log.DebugFormat(
904 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 910 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
@@ -929,7 +935,7 @@ namespace OpenSim.Region.Framework.Scenes
929 avatar.Scene.InformClientOfNeighbours(avatar); 935 avatar.Scene.InformClientOfNeighbours(avatar);
930 936
931 // Finally, kill the agent we just created at the destination. 937 // Finally, kill the agent we just created at the destination.
932 m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID); 938 m_scene.SimulationService.CloseAgent(reg, avatar.UUID);
933 939
934 return; 940 return;
935 } 941 }
@@ -943,7 +949,7 @@ namespace OpenSim.Region.Framework.Scenes
943 avatar.MakeChildAgent(); 949 avatar.MakeChildAgent();
944 950
945 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 951 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
946 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 952 avatar.CrossAttachmentsIntoNewRegion(reg, true);
947 953
948 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 954 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
949 955
@@ -1338,9 +1344,9 @@ namespace OpenSim.Region.Framework.Scenes
1338 if (isFlying) 1344 if (isFlying)
1339 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1345 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
1340 cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + 1346 cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
1341 "/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; 1347 "/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionID.ToString() + "/release/";
1342 1348
1343 m_interregionCommsOut.SendChildAgentUpdate(neighbourHandle, cAgent); 1349 m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent);
1344 1350
1345 // Next, let's close the child agent connections that are too far away. 1351 // Next, let's close the child agent connections that are too far away.
1346 agent.CloseChildAgents(neighbourx, neighboury); 1352 agent.CloseChildAgents(neighbourx, neighboury);
@@ -1391,7 +1397,7 @@ namespace OpenSim.Region.Framework.Scenes
1391 // now we have a child agent in this region. Request all interesting data about other (root) agents 1397 // now we have a child agent in this region. Request all interesting data about other (root) agents
1392 agent.SendInitialFullUpdateToAllClients(); 1398 agent.SendInitialFullUpdateToAllClients();
1393 1399
1394 agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); 1400 agent.CrossAttachmentsIntoNewRegion(neighbourRegion, true);
1395 1401
1396 // m_scene.SendKillObject(m_localId); 1402 // m_scene.SendKillObject(m_localId);
1397 1403
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8545425..385a9cd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -246,6 +246,8 @@ namespace OpenSim.Region.Framework.Scenes
246 246
247 // For teleports and crossings callbacks 247 // For teleports and crossings callbacks
248 string m_callbackURI; 248 string m_callbackURI;
249 UUID m_originRegionID;
250
249 ulong m_rootRegionHandle; 251 ulong m_rootRegionHandle;
250 252
251 /// <value> 253 /// <value>
@@ -890,7 +892,9 @@ namespace OpenSim.Region.Framework.Scenes
890 presence.Animator.SendAnimPackToClient(ControllingClient); 892 presence.Animator.SendAnimPackToClient(ControllingClient);
891 } 893 }
892 894
895 m_log.Warn("BEFORE ON MAKE ROOT");
893 m_scene.EventManager.TriggerOnMakeRootAgent(this); 896 m_scene.EventManager.TriggerOnMakeRootAgent(this);
897 m_log.Warn("AFTER ON MAKE ROOT");
894 } 898 }
895 899
896 /// <summary> 900 /// <summary>
@@ -1094,7 +1098,7 @@ namespace OpenSim.Region.Framework.Scenes
1094 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1098 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1095 { 1099 {
1096 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); 1100 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1097 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); 1101 Scene.SendReleaseAgent(m_originRegionID, UUID, m_callbackURI);
1098 m_callbackURI = null; 1102 m_callbackURI = null;
1099 } 1103 }
1100 1104
@@ -1102,7 +1106,6 @@ namespace OpenSim.Region.Framework.Scenes
1102 1106
1103 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 1107 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
1104 SendInitialData(); 1108 SendInitialData();
1105
1106 } 1109 }
1107 1110
1108 /// <summary> 1111 /// <summary>
@@ -2482,7 +2485,7 @@ namespace OpenSim.Region.Framework.Scenes
2482 2485
2483 SendInitialFullUpdateToAllClients(); 2486 SendInitialFullUpdateToAllClients();
2484 SendAppearanceToAllOtherAgents(); 2487 SendAppearanceToAllOtherAgents();
2485 } 2488 }
2486 2489
2487 /// <summary> 2490 /// <summary>
2488 /// Tell the client for this scene presence what items it should be wearing now 2491 /// Tell the client for this scene presence what items it should be wearing now
@@ -2937,7 +2940,7 @@ namespace OpenSim.Region.Framework.Scenes
2937 public void CopyTo(AgentData cAgent) 2940 public void CopyTo(AgentData cAgent)
2938 { 2941 {
2939 cAgent.AgentID = UUID; 2942 cAgent.AgentID = UUID;
2940 cAgent.RegionHandle = m_rootRegionHandle; 2943 cAgent.RegionID = Scene.RegionInfo.RegionID;
2941 2944
2942 cAgent.Position = AbsolutePosition; 2945 cAgent.Position = AbsolutePosition;
2943 cAgent.Velocity = m_velocity; 2946 cAgent.Velocity = m_velocity;
@@ -3036,7 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes
3036 3039
3037 public void CopyFrom(AgentData cAgent) 3040 public void CopyFrom(AgentData cAgent)
3038 { 3041 {
3039 m_rootRegionHandle = cAgent.RegionHandle; 3042 m_originRegionID = cAgent.RegionID;
3040 3043
3041 m_callbackURI = cAgent.CallbackURI; 3044 m_callbackURI = cAgent.CallbackURI;
3042 3045
@@ -3406,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes
3406 } 3409 }
3407 } 3410 }
3408 3411
3409 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) 3412 public bool CrossAttachmentsIntoNewRegion(GridRegion destination, bool silent)
3410 { 3413 {
3411 lock (m_attachments) 3414 lock (m_attachments)
3412 { 3415 {
@@ -3427,8 +3430,8 @@ namespace OpenSim.Region.Framework.Scenes
3427 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 3430 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
3428 gobj.RootPart.IsAttachment = false; 3431 gobj.RootPart.IsAttachment = false;
3429 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 3432 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
3430 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); 3433 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
3431 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); 3434 m_scene.CrossPrimGroupIntoNewRegion(destination, gobj, silent);
3432 } 3435 }
3433 } 3436 }
3434 m_attachments.Clear(); 3437 m_attachments.Clear();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index f00dd66..51134a9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -373,7 +373,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
373 373
374 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); 374 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
375 375
376 Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); 376 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
377 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); 377 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
378 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 378 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
379 } 379 }
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index ccb4c70..782034b 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -313,7 +313,7 @@ namespace OpenSim.Server.Handlers.Simulation
313 destination.RegionID = regionID; 313 destination.RegionID = regionID;
314 314
315 if (action.Equals("release")) 315 if (action.Equals("release"))
316 m_SimulationService.ReleaseAgent(destination, id, ""); 316 m_SimulationService.ReleaseAgent(regionID, id, "");
317 else 317 else
318 m_SimulationService.CloseAgent(destination, id); 318 m_SimulationService.CloseAgent(destination, id);
319 319
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index dc532d0..76558aa 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -385,14 +385,89 @@ namespace OpenSim.Services.Connectors.Simulation
385 return false; 385 return false;
386 } 386 }
387 387
388 public bool ReleaseAgent(GridRegion destination, UUID id, string uri) 388 public bool ReleaseAgent(UUID origin, UUID id, string uri)
389 { 389 {
390 return false; 390 WebRequest request = WebRequest.Create(uri);
391 request.Method = "DELETE";
392 request.Timeout = 10000;
393
394 StreamReader sr = null;
395 try
396 {
397 WebResponse webResponse = request.GetResponse();
398 if (webResponse == null)
399 {
400 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on ReleaseAgent");
401 }
402
403 sr = new StreamReader(webResponse.GetResponseStream());
404 //reply = sr.ReadToEnd().Trim();
405 sr.ReadToEnd().Trim();
406 sr.Close();
407 //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
408
409 }
410 catch (WebException ex)
411 {
412 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ReleaseAgent {0}", ex.Message);
413 return false;
414 }
415 finally
416 {
417 if (sr != null)
418 sr.Close();
419 }
420
421 return true;
391 } 422 }
392 423
393 public bool CloseAgent(GridRegion destination, UUID id) 424 public bool CloseAgent(GridRegion destination, UUID id)
394 { 425 {
395 return false; 426 string uri = string.Empty;
427 try
428 {
429 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/agent/" + id + "/" + destination.RegionHandle.ToString() + "/";
430 }
431 catch (Exception e)
432 {
433 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
434 return false;
435 }
436
437 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
438
439 WebRequest request = WebRequest.Create(uri);
440 request.Method = "DELETE";
441 request.Timeout = 10000;
442
443 StreamReader sr = null;
444 try
445 {
446 WebResponse webResponse = request.GetResponse();
447 if (webResponse == null)
448 {
449 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on agent delete ");
450 }
451
452 sr = new StreamReader(webResponse.GetResponseStream());
453 //reply = sr.ReadToEnd().Trim();
454 sr.ReadToEnd().Trim();
455 sr.Close();
456 //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
457
458 }
459 catch (WebException ex)
460 {
461 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete {0}", ex.Message);
462 return false;
463 }
464 finally
465 {
466 if (sr != null)
467 sr.Close();
468 }
469
470 return true;
396 } 471 }
397 472
398 #endregion Agents 473 #endregion Agents
@@ -401,11 +476,97 @@ namespace OpenSim.Services.Connectors.Simulation
401 476
402 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 477 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
403 { 478 {
404 return false; 479 string uri
480 = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/object/" + sog.UUID + "/";
481 //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri);
482
483 WebRequest ObjectCreateRequest = WebRequest.Create(uri);
484 ObjectCreateRequest.Method = "POST";
485 ObjectCreateRequest.ContentType = "application/json";
486 ObjectCreateRequest.Timeout = 10000;
487
488 OSDMap args = new OSDMap(2);
489 args["sog"] = OSD.FromString(sog.ToXml2());
490 args["extra"] = OSD.FromString(sog.ExtraToXmlString());
491 string state = sog.GetStateSnapshot();
492 if (state.Length > 0)
493 args["state"] = OSD.FromString(state);
494 // Add the input general arguments
495 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
496 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
497 args["destination_name"] = OSD.FromString(destination.RegionName);
498 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
499
500 string strBuffer = "";
501 byte[] buffer = new byte[1];
502 try
503 {
504 strBuffer = OSDParser.SerializeJsonString(args);
505 Encoding str = Util.UTF8;
506 buffer = str.GetBytes(strBuffer);
507
508 }
509 catch (Exception e)
510 {
511 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of CreateObject: {0}", e.Message);
512 // ignore. buffer will be empty, caller should check.
513 }
514
515 Stream os = null;
516 try
517 { // send the Post
518 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
519 os = ObjectCreateRequest.GetRequestStream();
520 os.Write(buffer, 0, strBuffer.Length); //Send it
521 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri);
522 }
523 catch (WebException ex)
524 {
525 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message);
526 return false;
527 }
528 finally
529 {
530 if (os != null)
531 os.Close();
532 }
533
534 // Let's wait for the response
535 //m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
536
537 StreamReader sr = null;
538 try
539 {
540 WebResponse webResponse = ObjectCreateRequest.GetResponse();
541 if (webResponse == null)
542 {
543 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post");
544 return false;
545 }
546
547 sr = new StreamReader(webResponse.GetResponseStream());
548 //reply = sr.ReadToEnd().Trim();
549 sr.ReadToEnd().Trim();
550 //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", reply);
551
552 }
553 catch (WebException ex)
554 {
555 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message);
556 return false;
557 }
558 finally
559 {
560 if (sr != null)
561 sr.Close();
562 }
563
564 return true;
405 } 565 }
406 566
407 public bool CreateObject(GridRegion destination, UUID userID, UUID itemID) 567 public bool CreateObject(GridRegion destination, UUID userID, UUID itemID)
408 { 568 {
569 // TODO, not that urgent
409 return false; 570 return false;
410 } 571 }
411 572
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 14f462c..ec24d90 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces
67 /// <param name="id"></param> 67 /// <param name="id"></param>
68 /// <param name="uri"></param> 68 /// <param name="uri"></param>
69 /// <returns></returns> 69 /// <returns></returns>
70 bool ReleaseAgent(GridRegion destination, UUID id, string uri); 70 bool ReleaseAgent(UUID originRegion, UUID id, string uri);
71 71
72 /// <summary> 72 /// <summary>
73 /// Close agent. 73 /// Close agent.