* Finished SimulationServiceConnector

* Started rerouting calls to UserService.
* Compiles. May run.
slimupdates
Diva Canto 2010-01-07 15:53:55 -08:00
parent 39293758f1
commit f11a97f12d
17 changed files with 359 additions and 128 deletions

View File

@ -274,7 +274,7 @@ namespace OpenSim.Framework
get { return m_id; }
set { m_id = value; }
}
public ulong RegionHandle;
public UUID RegionID;
public uint CircuitCode;
public UUID SessionID;
@ -321,7 +321,7 @@ namespace OpenSim.Framework
OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentData");
args["region_handle"] = OSD.FromString(RegionHandle.ToString());
args["region_id"] = OSD.FromString(RegionID.ToString());
args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
args["agent_uuid"] = OSD.FromUUID(AgentID);
args["session_uuid"] = OSD.FromUUID(SessionID);
@ -414,8 +414,8 @@ namespace OpenSim.Framework
/// <param name="hash"></param>
public virtual void Unpack(OSDMap args)
{
if (args.ContainsKey("region_handle"))
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
if (args.ContainsKey("region_id"))
UUID.TryParse(args["region_id"].AsString(), out RegionID);
if (args["circuit_code"] != null)
UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
@ -572,7 +572,7 @@ namespace OpenSim.Framework
{
System.Console.WriteLine("------------ AgentData ------------");
System.Console.WriteLine("UUID: " + AgentID);
System.Console.WriteLine("Region: " + RegionHandle);
System.Console.WriteLine("Region: " + RegionID);
System.Console.WriteLine("Position: " + Position);
}
}

View File

@ -37,6 +37,8 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
@ -46,10 +48,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private bool m_Enabled = false;
protected List<Scene> m_Scenes = new List<Scene>();
protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>();
public event UndeliveredMessage OnUndeliveredMessage;
private IPresenceService m_PresenceService;
protected IPresenceService PresenceService
{
get
{
if (m_PresenceService == null)
m_PresenceService = m_Scenes[0].RequestModuleInterface<IPresenceService>();
return m_PresenceService;
}
}
public virtual void Initialise(IConfigSource config)
{
IConfig cnf = config.Configs["Messaging"];
@ -416,7 +429,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
/// <summary>
/// delegate for sending a grid instant message asynchronously
/// </summary>
public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle);
public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID);
protected virtual void GridInstantMessageCompleted(IAsyncResult iar)
{
@ -430,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync;
d.BeginInvoke(im, result, 0, GridInstantMessageCompleted, d);
d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d);
}
/// <summary>
@ -445,11 +458,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
/// Pass in 0 the first time this method is called. It will be called recursively with the last
/// regionhandle tried
/// </param>
protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, ulong prevRegionHandle)
protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID)
{
UUID toAgentID = new UUID(im.toAgentID);
UserAgentData upd = null;
PresenceInfo upd = null;
bool lookupAgent = false;
@ -457,13 +470,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
if (m_UserRegionMap.ContainsKey(toAgentID))
{
upd = new UserAgentData();
upd.AgentOnline = true;
upd.Handle = m_UserRegionMap[toAgentID];
upd = new PresenceInfo();
upd.Online = true;
upd.RegionID = m_UserRegionMap[toAgentID];
// We need to compare the current regionhandle with the previous region handle
// or the recursive loop will never end because it will never try to lookup the agent again
if (prevRegionHandle == upd.Handle)
if (prevRegionID == upd.RegionID)
{
lookupAgent = true;
}
@ -479,14 +492,23 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (lookupAgent)
{
// Non-cached user agent lookup.
upd = m_Scenes[0].CommsManager.UserService.GetAgentByUUID(toAgentID);
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
if (presences != null)
{
foreach (PresenceInfo p in presences)
if (p.Online)
{
upd = presences[0];
break;
}
}
if (upd != null)
{
// check if we've tried this before..
// This is one way to end the recursive loop
//
if (upd.Handle == prevRegionHandle)
if (upd.RegionID == prevRegionID)
{
m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
HandleUndeliveredMessage(im, result);
@ -503,12 +525,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (upd != null)
{
if (upd.AgentOnline)
if (upd.Online)
{
uint x = 0, y = 0;
Utils.LongToUInts(upd.Handle, out x, out y);
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByPosition(m_Scenes[0].RegionInfo.ScopeID,
(int)x, (int)y);
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
upd.RegionID);
if (reginfo != null)
{
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
@ -524,11 +544,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
if (m_UserRegionMap.ContainsKey(toAgentID))
{
m_UserRegionMap[toAgentID] = upd.Handle;
m_UserRegionMap[toAgentID] = upd.RegionID;
}
else
{
m_UserRegionMap.Add(toAgentID, upd.Handle);
m_UserRegionMap.Add(toAgentID, upd.RegionID);
}
}
result(true);
@ -543,12 +563,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// This is recursive!!!!!
SendGridInstantMessageViaXMLRPCAsync(im, result,
upd.Handle);
upd.RegionID);
}
}
else
{
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.Handle);
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
HandleUndeliveredMessage(im, result);
}
}

View File

@ -335,7 +335,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
try
{
if (m_aScene.CommsManager.UserService.AuthenticateUserByPassword(userInfo.UserProfile.ID, pass))
if (m_aScene.AuthenticationService.Authenticate(userInfo.UserProfile.ID, pass, 1) != string.Empty)
{
return userInfo;
}

View File

@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
public void RequestAvatarProperty(IClientAPI remoteClient, UUID avatarID)
{
// FIXME: finish adding fields such as url, masking, etc.
UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(avatarID);
UserProfileData profile = null; // m_scene.CommsManager.UserService.GetUserProfile(avatarID);
if (null != profile)
{
Byte[] charterMember;
@ -143,26 +143,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
public void UpdateAvatarProperties(IClientAPI remoteClient, UserProfileData newProfile)
{
UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID);
return;
//UserProfileData Profile = m_scene.CommsManager.UserService.GetUserProfile(newProfile.ID);
// if it's the profile of the user requesting the update, then we change only a few things.
if (remoteClient.AgentId.CompareTo(Profile.ID) == 0)
{
Profile.Image = newProfile.Image;
Profile.FirstLifeImage = newProfile.FirstLifeImage;
Profile.AboutText = newProfile.AboutText;
Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText;
Profile.ProfileUrl = newProfile.ProfileUrl;
}
else
{
return;
}
if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile))
{
RequestAvatarProperty(remoteClient, newProfile.ID);
}
//// if it's the profile of the user requesting the update, then we change only a few things.
//if (remoteClient.AgentId.CompareTo(Profile.ID) == 0)
//{
// Profile.Image = newProfile.Image;
// Profile.FirstLifeImage = newProfile.FirstLifeImage;
// Profile.AboutText = newProfile.AboutText;
// Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText;
// Profile.ProfileUrl = newProfile.ProfileUrl;
//}
//else
//{
// return;
//}
//if (m_scene.CommsManager.UserService.UpdateUserProfile(Profile))
//{
// RequestAvatarProperty(remoteClient, newProfile.ID);
//}
}
}
}

View File

@ -139,9 +139,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
if (scene != null)
{
UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID));
isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName,
profile.Email, scene.RegionInfo.RegionName, regionID, out message);
UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, userID);
isAuthorized = IsAuthorizedForRegion(userID, account.FirstName, account.LastName,
account.Email, scene.RegionInfo.RegionName, regionID, out message);
}
else
{

View File

@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
public string Name
{
get { return "RemotePresenceServiceConnector"; }
get { return "RemotePresenceServicesConnector"; }
}
public void Initialise(IConfigSource source)

View File

@ -172,12 +172,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
{
// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
return s.NewUserConnection(aCircuit, teleportFlags, out reason);
}
}
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", destination.RegionName);
reason = "Did not find region " + destination.RegionName;
return false;
}
@ -241,14 +241,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
public bool ReleaseAgent(GridRegion destination, UUID id, string uri)
public bool ReleaseAgent(UUID origin, UUID id, string uri)
{
if (destination == null)
return false;
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
if (s.RegionInfo.RegionID == origin)
{
//m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
return s.IncomingReleaseAgent(id);
@ -334,6 +331,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
public bool IsLocalRegion(UUID id)
{
foreach (Scene s in m_sceneList)
if (s.RegionInfo.RegionID == id)
return true;
return false;
}
#endregion
}
}

View File

@ -245,18 +245,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
}
public bool ReleaseAgent(GridRegion destination, UUID id, string uri)
public bool ReleaseAgent(UUID origin, UUID id, string uri)
{
if (destination == null)
return false;
// Try local first
if (m_localBackend.ReleaseAgent(destination, id, uri))
if (m_localBackend.ReleaseAgent(origin, id, uri))
return true;
// else do the remote thing
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
return m_remoteConnector.ReleaseAgent(destination, id, uri);
if (!m_localBackend.IsLocalRegion(origin))
return m_remoteConnector.ReleaseAgent(origin, id, uri);
return false;
}

View File

@ -202,8 +202,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
string reason = String.Empty;
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
if (!m_scene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
{
avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
reason));
@ -282,9 +281,9 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
avatar.CopyTo(agent);
agent.Position = position;
agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionID.ToString() + "/release/";
m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
m_scene.SimulationService.UpdateAgent(reg, agent);
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID);
@ -322,8 +321,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
avatar.Scene.InformClientOfNeighbours(avatar);
// Finally, kill the agent we just created at the destination.
m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID);
m_scene.SimulationService.CloseAgent(reg, avatar.UUID);
return;
}
@ -336,7 +334,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
avatar.MakeChildAgent();
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
avatar.CrossAttachmentsIntoNewRegion(reg, true);
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone

View File

@ -1163,15 +1163,21 @@ namespace OpenSim.Region.Framework.Scenes
private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
{
if (folder == null)
return;
m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName);
InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
InventoryFolderBase containingFolder = new InventoryFolderBase();
containingFolder.ID = folder.ID;
containingFolder.Owner = client.AgentId;
containingFolder = InventoryService.GetFolder(containingFolder);
int version = containingFolder.Version;
if (containingFolder != null)
{
int version = containingFolder.Version;
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems);
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems);
}
}
/// <summary>

View File

@ -253,6 +253,49 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected ISimulationService m_simulationService;
public ISimulationService SimulationService
{
get
{
if (m_simulationService == null)
m_simulationService = RequestModuleInterface<ISimulationService>();
return m_simulationService;
}
}
protected IAuthenticationService m_AuthenticationService;
public IAuthenticationService AuthenticationService
{
get
{
if (m_AuthenticationService == null)
m_AuthenticationService = RequestModuleInterface<IAuthenticationService>();
return m_AuthenticationService;
}
}
protected IPresenceService m_PresenceService;
public IPresenceService PresenceService
{
get
{
if (m_PresenceService == null)
m_PresenceService = RequestModuleInterface<IPresenceService>();
return m_PresenceService;
}
}
protected IUserAccountService m_UserAccountService;
public IUserAccountService UserAccountService
{
get
{
if (m_UserAccountService == null)
m_UserAccountService = RequestModuleInterface<IUserAccountService>();
return m_UserAccountService;
}
}
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
@ -262,8 +305,6 @@ namespace OpenSim.Region.Framework.Scenes
}
protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser;
protected IInterregionCommsOut m_interregionCommsOut;
protected IInterregionCommsIn m_interregionCommsIn;
protected IDialogModule m_dialogModule;
protected ITeleportModule m_teleportModule;
@ -1136,8 +1177,6 @@ namespace OpenSim.Region.Framework.Scenes
XferManager = RequestModuleInterface<IXfer>();
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
m_dialogModule = RequestModuleInterface<IDialogModule>();
m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
m_teleportModule = RequestModuleInterface<ITeleportModule>();
@ -2155,7 +2194,10 @@ namespace OpenSim.Region.Framework.Scenes
grp.OffsetForNewRegion(pos);
// If we fail to cross the border, then reset the position of the scene object on that border.
if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent))
uint x = 0, y = 0;
Utils.LongToUInts(newRegionHandle, out x, out y);
GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
{
grp.OffsetForNewRegion(oldGroupPosition);
grp.ScheduleGroupForFullUpdate();
@ -2351,7 +2393,7 @@ namespace OpenSim.Region.Framework.Scenes
/// true if the crossing itself was successful, false on failure
/// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
/// </returns>
public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent)
public bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
{
//m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
@ -2359,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes
grp.RootPart.UpdateFlag = 0;
//int primcrossingXMLmethod = 0;
if (newRegionHandle != 0)
if (destination != null)
{
//string objectState = grp.GetStateSnapshot();
@ -2372,9 +2414,11 @@ namespace OpenSim.Region.Framework.Scenes
// newRegionHandle, grp.UUID, objectState, 100);
//}
// And the new channel...
if (m_interregionCommsOut != null)
successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
//// And the new channel...
//if (m_interregionCommsOut != null)
// successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
if (m_simulationService != null)
successYN = m_simulationService.CreateObject(destination, grp, true);
if (successYN)
{
@ -2405,7 +2449,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()");
m_log.Error("[INTERREGION]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
}
return successYN;
@ -2598,10 +2642,9 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Debug(logMsg);
*/
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
//CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
ScenePresence sp = CreateAndAddScenePresence(client);
// HERE!!! Do the initial attachments right here
// first agent upon login is a root agent by design.
// All other AddNewClient calls find aCircuit.child to be true
@ -2614,6 +2657,7 @@ namespace OpenSim.Region.Framework.Scenes
m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client);
}
@ -3289,14 +3333,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.KiPrimitive += SendKillObject;
m_sceneGridService.OnGetLandData += GetLandData;
if (m_interregionCommsIn != null)
{
m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
}
else
m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
}
/// <summary>
@ -3314,9 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
m_sceneGridService.OnGetLandData -= GetLandData;
if (m_interregionCommsIn != null)
m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
// this does nothing; should be removed
m_sceneGridService.Close();
@ -3758,9 +3791,10 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGridService.ReleaseAgent(id);
}
public void SendReleaseAgent(ulong regionHandle, UUID id, string uri)
public void SendReleaseAgent(UUID origin, UUID id, string uri)
{
m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
//m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
m_simulationService.ReleaseAgent(origin, id, uri);
}
/// <summary>

View File

@ -57,7 +57,6 @@ namespace OpenSim.Region.Framework.Scenes
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected CommunicationsManager m_commsProvider;
protected IInterregionCommsOut m_interregionCommsOut;
protected RegionInfo m_regionInfo;
protected Scene m_scene;
@ -135,7 +134,6 @@ namespace OpenSim.Region.Framework.Scenes
{
m_scene = s;
m_regionInfo = s.RegionInfo;
m_interregionCommsOut = m_scene.RequestModuleInterface<IInterregionCommsOut>();
}
/// <summary>
@ -255,6 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
{
InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
icon.EndInvoke(iar);
m_log.WarnFormat(" --> InformClientOfNeighbourCompleted");
}
/// <summary>
@ -285,8 +284,8 @@ namespace OpenSim.Region.Framework.Scenes
string reason = String.Empty;
bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, 0, out reason); // m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
if (regionAccepted && newAgent)
{
@ -460,6 +459,7 @@ namespace OpenSim.Region.Framework.Scenes
int count = 0;
foreach (GridRegion neighbour in neighbours)
{
m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName);
// Don't do it if there's already an agent in that region
if (newRegions.Contains(neighbour.RegionHandle))
newAgent = true;
@ -600,7 +600,10 @@ namespace OpenSim.Region.Framework.Scenes
try
{
//m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
m_scene.SimulationService.UpdateAgent(destination, cAgentData);
}
catch
{
@ -660,7 +663,10 @@ namespace OpenSim.Region.Framework.Scenes
// let's do our best, but there's not much we can do if the neighbour doesn't accept.
//m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
m_interregionCommsOut.SendCloseAgent(regionHandle, agentID);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
m_scene.SimulationService.CloseAgent(destination, agentID);
}
private void SendCloseChildAgentCompleted(IAsyncResult iar)
@ -810,7 +816,7 @@ namespace OpenSim.Region.Framework.Scenes
// Let's create an agent there if one doesn't exist yet.
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
if (!m_scene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
{
avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
reason));
@ -896,9 +902,9 @@ namespace OpenSim.Region.Framework.Scenes
avatar.CopyTo(agent);
agent.Position = position;
agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionID.ToString() + "/release/";
m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
m_scene.SimulationService.UpdateAgent(reg, agent);
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
@ -929,7 +935,7 @@ namespace OpenSim.Region.Framework.Scenes
avatar.Scene.InformClientOfNeighbours(avatar);
// Finally, kill the agent we just created at the destination.
m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID);
m_scene.SimulationService.CloseAgent(reg, avatar.UUID);
return;
}
@ -943,7 +949,7 @@ namespace OpenSim.Region.Framework.Scenes
avatar.MakeChildAgent();
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
avatar.CrossAttachmentsIntoNewRegion(reg, true);
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
@ -1338,9 +1344,9 @@ namespace OpenSim.Region.Framework.Scenes
if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
"/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
"/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionID.ToString() + "/release/";
m_interregionCommsOut.SendChildAgentUpdate(neighbourHandle, cAgent);
m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent);
// Next, let's close the child agent connections that are too far away.
agent.CloseChildAgents(neighbourx, neighboury);
@ -1391,7 +1397,7 @@ namespace OpenSim.Region.Framework.Scenes
// now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendInitialFullUpdateToAllClients();
agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true);
agent.CrossAttachmentsIntoNewRegion(neighbourRegion, true);
// m_scene.SendKillObject(m_localId);

View File

@ -246,6 +246,8 @@ namespace OpenSim.Region.Framework.Scenes
// For teleports and crossings callbacks
string m_callbackURI;
UUID m_originRegionID;
ulong m_rootRegionHandle;
/// <value>
@ -890,7 +892,9 @@ namespace OpenSim.Region.Framework.Scenes
presence.Animator.SendAnimPackToClient(ControllingClient);
}
m_log.Warn("BEFORE ON MAKE ROOT");
m_scene.EventManager.TriggerOnMakeRootAgent(this);
m_log.Warn("AFTER ON MAKE ROOT");
}
/// <summary>
@ -1094,7 +1098,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
{
m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
Scene.SendReleaseAgent(m_originRegionID, UUID, m_callbackURI);
m_callbackURI = null;
}
@ -1102,7 +1106,6 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
SendInitialData();
}
/// <summary>
@ -2482,7 +2485,7 @@ namespace OpenSim.Region.Framework.Scenes
SendInitialFullUpdateToAllClients();
SendAppearanceToAllOtherAgents();
}
}
/// <summary>
/// Tell the client for this scene presence what items it should be wearing now
@ -2937,7 +2940,7 @@ namespace OpenSim.Region.Framework.Scenes
public void CopyTo(AgentData cAgent)
{
cAgent.AgentID = UUID;
cAgent.RegionHandle = m_rootRegionHandle;
cAgent.RegionID = Scene.RegionInfo.RegionID;
cAgent.Position = AbsolutePosition;
cAgent.Velocity = m_velocity;
@ -3036,7 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes
public void CopyFrom(AgentData cAgent)
{
m_rootRegionHandle = cAgent.RegionHandle;
m_originRegionID = cAgent.RegionID;
m_callbackURI = cAgent.CallbackURI;
@ -3406,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent)
public bool CrossAttachmentsIntoNewRegion(GridRegion destination, bool silent)
{
lock (m_attachments)
{
@ -3427,8 +3430,8 @@ namespace OpenSim.Region.Framework.Scenes
gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
gobj.RootPart.IsAttachment = false;
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle);
m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent);
m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
m_scene.CrossPrimGroupIntoNewRegion(destination, gobj, silent);
}
}
m_attachments.Clear();

View File

@ -373,7 +373,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
//Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
}

View File

@ -313,7 +313,7 @@ namespace OpenSim.Server.Handlers.Simulation
destination.RegionID = regionID;
if (action.Equals("release"))
m_SimulationService.ReleaseAgent(destination, id, "");
m_SimulationService.ReleaseAgent(regionID, id, "");
else
m_SimulationService.CloseAgent(destination, id);

View File

@ -385,14 +385,89 @@ namespace OpenSim.Services.Connectors.Simulation
return false;
}
public bool ReleaseAgent(GridRegion destination, UUID id, string uri)
public bool ReleaseAgent(UUID origin, UUID id, string uri)
{
return false;
WebRequest request = WebRequest.Create(uri);
request.Method = "DELETE";
request.Timeout = 10000;
StreamReader sr = null;
try
{
WebResponse webResponse = request.GetResponse();
if (webResponse == null)
{
m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on ReleaseAgent");
}
sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
sr.Close();
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ReleaseAgent {0}", ex.Message);
return false;
}
finally
{
if (sr != null)
sr.Close();
}
return true;
}
public bool CloseAgent(GridRegion destination, UUID id)
{
return false;
string uri = string.Empty;
try
{
uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/agent/" + id + "/" + destination.RegionHandle.ToString() + "/";
}
catch (Exception e)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
return false;
}
//Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
WebRequest request = WebRequest.Create(uri);
request.Method = "DELETE";
request.Timeout = 10000;
StreamReader sr = null;
try
{
WebResponse webResponse = request.GetResponse();
if (webResponse == null)
{
m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on agent delete ");
}
sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
sr.Close();
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete {0}", ex.Message);
return false;
}
finally
{
if (sr != null)
sr.Close();
}
return true;
}
#endregion Agents
@ -401,11 +476,97 @@ namespace OpenSim.Services.Connectors.Simulation
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
{
return false;
string uri
= "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + "/object/" + sog.UUID + "/";
//m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri);
WebRequest ObjectCreateRequest = WebRequest.Create(uri);
ObjectCreateRequest.Method = "POST";
ObjectCreateRequest.ContentType = "application/json";
ObjectCreateRequest.Timeout = 10000;
OSDMap args = new OSDMap(2);
args["sog"] = OSD.FromString(sog.ToXml2());
args["extra"] = OSD.FromString(sog.ExtraToXmlString());
string state = sog.GetStateSnapshot();
if (state.Length > 0)
args["state"] = OSD.FromString(state);
// Add the input general arguments
args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
string strBuffer = "";
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
Encoding str = Util.UTF8;
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Exception thrown on serialization of CreateObject: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
os = ObjectCreateRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri);
}
catch (WebException ex)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message);
return false;
}
finally
{
if (os != null)
os.Close();
}
// Let's wait for the response
//m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
StreamReader sr = null;
try
{
WebResponse webResponse = ObjectCreateRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post");
return false;
}
sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
//m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message);
return false;
}
finally
{
if (sr != null)
sr.Close();
}
return true;
}
public bool CreateObject(GridRegion destination, UUID userID, UUID itemID)
{
// TODO, not that urgent
return false;
}

View File

@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces
/// <param name="id"></param>
/// <param name="uri"></param>
/// <returns></returns>
bool ReleaseAgent(GridRegion destination, UUID id, string uri);
bool ReleaseAgent(UUID originRegion, UUID id, string uri);
/// <summary>
/// Close agent.