From fd2caf5f1673ad14702d89db9804f841c5cb861a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 30 Mar 2008 08:01:47 +0000 Subject: This update has good news and bad news, first the bad. * This update breaks inter-region communications, sorry. * You will need to run prebuild. Next, the good; * This update solves the unexpected binary element when Linux simulators inform windows simulators and vice versa. So Linux Simulators and Windows simulators are 100% compatible again. * This update introduces an Integer in the prim crossing method to tell the receiving simulator which XML method to use to load the prim that crossed the border. If the receiving prim doesn't support the method, the prim crossing fails and no prims are lost. That being said, it's best to update all your simulators to this revision at once. --- .../Communications/IInterRegionCommunications.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 8 +++++ OpenSim/Framework/IRegionCommsListener.cs | 2 +- OpenSim/Framework/RegionCommsListener.cs | 4 +-- OpenSim/Framework/RegionInfo.cs | 17 +++++++++ OpenSim/Framework/RegionUpData.cs | 40 ++++++++++++++++++++++ OpenSim/Region/ClientStack/ClientView.cs | 21 ++++++++++++ .../Communications/Local/LocalBackEndServices.cs | 14 +++++--- .../Region/Communications/OGS1/OGS1GridServices.cs | 32 ++++++++++------- .../Communications/OGS1/OGS1InterSimComms.cs | 16 ++++----- OpenSim/Region/Environment/Scenes/Scene.cs | 17 +++++++-- .../Scenes/SceneCommunicationService.cs | 16 ++++++--- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 ++ 13 files changed, 155 insertions(+), 36 deletions(-) create mode 100644 OpenSim/Framework/RegionUpData.cs diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index e7e1737..f018dd6 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs @@ -35,7 +35,7 @@ namespace OpenSim.Framework.Communications bool Available { get; } void CheckRegion(string address, uint port); bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); - bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); + bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod); bool RegionUp(SearializableRegionInfo region, ulong regionhandle); bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 518659f..9dd17f9 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -302,6 +302,13 @@ namespace OpenSim.Framework public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags, LLUUID AgentID, LLUUID GroupID); + public delegate void ObjectDuplicateOnRay(uint localID, uint dupeFlags, LLUUID AgentID, LLUUID GroupID, + LLUUID RayTargetObj, LLVector3 RayEnd, LLVector3 RayStart, + bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates); + + + + public delegate void StatusChange(bool status); public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); @@ -463,6 +470,7 @@ namespace OpenSim.Framework event GodKickUser OnGodKickUser; event ObjectDuplicate OnObjectDuplicate; + event ObjectDuplicateOnRay OnObjectDuplicateOnRay; event UpdateVector OnGrabObject; event ObjectSelect OnDeGrabObject; event MoveObject OnGrabUpdate; diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index c10353b..7726634 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs @@ -32,7 +32,7 @@ namespace OpenSim.Framework { public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); - public delegate void ExpectPrimDelegate(ulong regionHandle, LLUUID primID, string objData); + public delegate bool ExpectPrimDelegate(ulong regionHandle, LLUUID primID, string objData, int XMLMethod); public delegate void UpdateNeighbours(List neighbours); diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index 13d1d28..ee2079b 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs @@ -78,12 +78,12 @@ namespace OpenSim.Framework } - public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData) + public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { handlerExpectPrim = OnExpectPrim; if (handlerExpectPrim != null) { - handlerExpectPrim(regionHandle, primID, objData); + handlerExpectPrim(regionHandle, primID, objData, XMLMethod); return true; } return false; diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index fc6da57..095740d 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -101,6 +101,12 @@ namespace OpenSim.Framework public bool m_allow_alternate_ports; protected string m_serverURI; + + public int getInternalEndPointPort() + { + return m_internalEndPoint.Port; + } + public string ServerURI { get @@ -279,6 +285,17 @@ namespace OpenSim.Framework RegionID = LLUUID.Zero; ServerURI = ConvertFrom.ServerURI; } + public int getInternalEndPointPort() + { + return m_internalEndPoint.Port; + } + public void SetEndPoint(string ipaddr, int port) + { + IPAddress tmpIP = IPAddress.Parse(ipaddr); + IPEndPoint tmpEPE= new IPEndPoint(tmpIP, port); + m_internalEndPoint = tmpEPE; + + } //not in use, should swap to nini though. public void LoadFromNiniSource(IConfigSource source) diff --git a/OpenSim/Framework/RegionUpData.cs b/OpenSim/Framework/RegionUpData.cs new file mode 100644 index 0000000..dbb805f --- /dev/null +++ b/OpenSim/Framework/RegionUpData.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework +{ + [Serializable] + public class RegionUpData + { + private uint m_X = 0; + private uint m_Y = 0; + private string m_ipaddr = ""; + private int m_port = 0; + public RegionUpData(uint X, uint Y, string ipaddr, int port) + { + m_X = X; + m_Y = Y; + m_ipaddr = ipaddr; + m_port = port; + } + + public uint X + { + get { return m_X; } + } + public uint Y + { + get { return m_Y; } + } + public string IPADDR + { + get { return m_ipaddr; } + } + public int PORT + { + get { return m_port; } + } + + } +} diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index a8762e4..10d052e 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -158,6 +158,7 @@ namespace OpenSim.Region.ClientStack private UpdateShape handlerUpdatePrimShape = null; //null; private ObjectExtraParams handlerUpdateExtraParams = null; //OnUpdateExtraParams; private ObjectDuplicate handlerObjectDuplicate = null; + private ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; private ObjectSelect handlerObjectSelect = null; private ObjectDeselect handlerObjectDeselect = null; private UpdatePrimFlags handlerUpdatePrimFlags = null; //OnUpdatePrimFlags; @@ -675,6 +676,7 @@ namespace OpenSim.Region.ClientStack public event UpdateVector OnGrabObject; public event ObjectSelect OnDeGrabObject; public event ObjectDuplicate OnObjectDuplicate; + public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; public event MoveObject OnGrabUpdate; public event AddNewPrim OnAddPrim; public event RequestGodlikePowers OnRequestGodlikePowers; @@ -3590,7 +3592,26 @@ namespace OpenSim.Region.ClientStack // That means multiple object perms may be updated in a single packet. break; + case PacketType.ObjectDuplicateOnRay: + ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; + handlerObjectDuplicateOnRay = null; + + + for (int i = 0; i < dupeOnRay.ObjectData.Length; i++) + { + handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; + if (handlerObjectDuplicateOnRay != null) + { + handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, + dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, + dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, + dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); + } + } + + break; + break; case PacketType.RequestObjectPropertiesFamily: //This powers the little tooltip that appears when you move your mouse over an object RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index de891a2..f5a5e83 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -225,6 +225,12 @@ namespace OpenSim.Region.Communications.Local public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) { RegionInfo region = new RegionInfo(sregion); + + //region.RegionLocX = sregion.X; + //region.RegionLocY = sregion.Y; + //region.SetEndPoint(sregion.IPADDR, sregion.PORT); + + //sregion); if (m_regionListeners.ContainsKey(regionhandle)) { return m_regionListeners[regionhandle].TriggerRegionUp(region); @@ -316,11 +322,11 @@ namespace OpenSim.Region.Communications.Local return false; } - public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { if (m_regionListeners.ContainsKey(regionHandle)) { - m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData); + m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); return true; } return false; @@ -408,11 +414,11 @@ namespace OpenSim.Region.Communications.Local } } - public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData) + public void TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { if (m_regionListeners.ContainsKey(regionHandle)) { - m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData); + m_regionListeners[regionHandle].TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index d19752c..22bb0f0 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -857,6 +857,8 @@ namespace OpenSim.Region.Communications.OGS1 // The region asking the grid services about itself.. // And, surprisingly, the reason is.. it doesn't know // it's own remoting port! How special. + RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); + region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); region.RemotingAddress = region.ExternalHostName; region.RemotingPort = NetworkServersInfo.RemotingListenerPort; @@ -885,7 +887,7 @@ namespace OpenSim.Region.Communications.OGS1 if (remObject != null) { - retValue = remObject.RegionUp(region, regionhandle); + retValue = remObject.RegionUp(regiondata, regionhandle); } else { @@ -962,7 +964,7 @@ namespace OpenSim.Region.Communications.OGS1 /// /// /// - public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { int failures = 0; lock (m_deadRegionCache) @@ -977,7 +979,7 @@ namespace OpenSim.Region.Communications.OGS1 RegionInfo regInfo = null; try { - if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData)) + if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod)) { return true; } @@ -996,7 +998,7 @@ namespace OpenSim.Region.Communications.OGS1 if (remObject != null) { - retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.UUID, objData); + retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.UUID, objData, XMLMethod); } else { @@ -1325,23 +1327,29 @@ namespace OpenSim.Region.Communications.OGS1 } } - public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) + public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) { m_log.Info("[OGS1 GRID SERVICES]: " + - gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + - "," + regionData.RegionLocY + "). Giving this region a fresh set of 'dead' tries"); + gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X + + "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); + RegionInfo nRegionInfo = new RegionInfo(); + nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); + nRegionInfo.ExternalHostName = regionData.IPADDR; + nRegionInfo.RegionLocX = regionData.X; + nRegionInfo.RegionLocY = regionData.Y; + try { lock (m_deadRegionCache) { - if (m_deadRegionCache.ContainsKey(regionData.RegionHandle)) + if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) { - m_deadRegionCache.Remove(regionData.RegionHandle); + m_deadRegionCache.Remove(nRegionInfo.RegionHandle); } } - return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); + return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); } catch (RemotingException e) @@ -1372,12 +1380,12 @@ namespace OpenSim.Region.Communications.OGS1 /// /// /// - public bool IncomingPrim(ulong regionHandle, LLUUID primID, string objData) + public bool IncomingPrim(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { // Is this necessary? try { - m_localBackend.TriggerExpectPrim(regionHandle, primID, objData); + m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); return true; //m_localBackend. } diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index c282464..2e106d7 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -38,9 +38,9 @@ namespace OpenSim.Region.Communications.OGS1 public delegate bool InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical); - public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); + public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData, int XMLMethod); - public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle); + public delegate bool RegionUp(RegionUpData region, ulong regionhandle); public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); @@ -90,7 +90,7 @@ namespace OpenSim.Region.Communications.OGS1 return false; } - public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) + public bool RegionUp(RegionUpData sregion, ulong regionhandle) { handlerRegionUp = OnRegionUp; if (handlerRegionUp != null) @@ -130,12 +130,12 @@ namespace OpenSim.Region.Communications.OGS1 return false; } - public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData, int XMLMethod) { handlerPrimGroupArrival = OnPrimGroupArrival; if (handlerPrimGroupArrival != null) { - return handlerPrimGroupArrival(regionHandle, primID, objData); + return handlerPrimGroupArrival(regionHandle, primID, objData, XMLMethod); } return false; } @@ -173,7 +173,7 @@ namespace OpenSim.Region.Communications.OGS1 } } - public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) + public bool RegionUp(RegionUpData region, ulong regionhandle) { try { @@ -232,11 +232,11 @@ namespace OpenSim.Region.Communications.OGS1 } } - public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData) + public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData, int XMLMethod) { try { - return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData); + return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData, XMLMethod); } catch (RemotingException e) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index c07f718..819815b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1242,6 +1242,9 @@ namespace OpenSim.Region.Environment.Scenes m_log.Warn("Prim crossing: " + grp.UUID.ToString()); int thisx = (int)RegionInfo.RegionLocX; int thisy = (int)RegionInfo.RegionLocY; + + int primcrossingXMLmethod = 0; + ulong newRegionHandle = 0; LLVector3 pos = position; @@ -1279,7 +1282,7 @@ namespace OpenSim.Region.Environment.Scenes if (newRegionHandle != 0) { bool successYN = false; - successYN = m_sceneGridService.PrimCrossToNeighboringRegion(newRegionHandle, grp.UUID, m_sceneXmlLoader.SavePrimGroupToXML2String(grp)); + successYN = m_sceneGridService.PrimCrossToNeighboringRegion(newRegionHandle, grp.UUID, m_sceneXmlLoader.SavePrimGroupToXML2String(grp), primcrossingXMLmethod); if (successYN) { // We remove the object here @@ -1306,10 +1309,18 @@ namespace OpenSim.Region.Environment.Scenes } } - public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData) + public bool IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData, int XMLMethod) { m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); - m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData); + if (XMLMethod == 0) + { + m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData); + return true; + } + else + { + return false; + } } diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 7653bf4..db2327e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -168,12 +168,16 @@ namespace OpenSim.Region.Environment.Scenes } } - protected void IncomingPrimCrossing(ulong regionHandle, LLUUID primID, String objXMLData) + protected bool IncomingPrimCrossing(ulong regionHandle, LLUUID primID, String objXMLData, int XMLMethod) { handlerExpectPrim = OnExpectPrim; if (handlerExpectPrim != null) { - handlerExpectPrim(regionHandle, primID, objXMLData); + return handlerExpectPrim(regionHandle, primID, objXMLData, XMLMethod); + } + else + { + return false; } } @@ -342,8 +346,10 @@ namespace OpenSim.Region.Environment.Scenes private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle) { m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); + //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); + bool regionAccepted = - m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle); + m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region), regionhandle); if (regionAccepted) { @@ -605,9 +611,9 @@ namespace OpenSim.Region.Environment.Scenes return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); } - public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, string objData) + public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, string objData, int XMLMethod) { - return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData); + return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData, XMLMethod); } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 705f27e..39d05eb 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -148,6 +148,8 @@ namespace OpenSim.Region.Examples.SimpleModule public event RegionInfoRequest OnRegionInfoRequest; public event EstateCovenantRequest OnEstateCovenantRequest; + public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; + public event FriendActionDelegate OnApproveFriendRequest; public event FriendActionDelegate OnDenyFriendRequest; public event FriendshipTermination OnTerminateFriendship; -- cgit v1.1