diff options
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 117 |
1 files changed, 54 insertions, 63 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ff0c01a..7f7ee82 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1892,11 +1892,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1892 | agent.Id0 = currentAgentCircuit.Id0; | 1892 | agent.Id0 = currentAgentCircuit.Id0; |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | ||
1896 | |||
1895 | IPEndPoint external = region.ExternalEndPoint; | 1897 | IPEndPoint external = region.ExternalEndPoint; |
1896 | if (external != null) | 1898 | if (external != null) |
1897 | { | 1899 | { |
1898 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1900 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1899 | d.BeginInvoke(sp, agent, region, external, true,true, | 1901 | d.BeginInvoke(sp, agent, region, external, true, |
1900 | InformClientOfNeighbourCompleted, | 1902 | InformClientOfNeighbourCompleted, |
1901 | d); | 1903 | d); |
1902 | } | 1904 | } |
@@ -1906,7 +1908,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1906 | #region Enable Child Agents | 1908 | #region Enable Child Agents |
1907 | 1909 | ||
1908 | private delegate void InformClientOfNeighbourDelegate( | 1910 | private delegate void InformClientOfNeighbourDelegate( |
1909 | ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent, bool doInitialDelay); | 1911 | ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent); |
1910 | 1912 | ||
1911 | /// <summary> | 1913 | /// <summary> |
1912 | /// This informs all neighbouring regions about agent "avatar". | 1914 | /// This informs all neighbouring regions about agent "avatar". |
@@ -1945,10 +1947,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1945 | List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); | 1947 | List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); |
1946 | List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); | 1948 | List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); |
1947 | 1949 | ||
1948 | // Dump("Current Neighbors", neighbourHandles); | 1950 | // Dump("Current Neighbors", neighbourHandles); |
1949 | // Dump("Previous Neighbours", previousRegionNeighbourHandles); | 1951 | // Dump("Previous Neighbours", previousRegionNeighbourHandles); |
1950 | // Dump("New Neighbours", newRegions); | 1952 | // Dump("New Neighbours", newRegions); |
1951 | // Dump("Old Neighbours", oldRegions); | 1953 | // Dump("Old Neighbours", oldRegions); |
1952 | 1954 | ||
1953 | /// Update the scene presence's known regions here on this region | 1955 | /// Update the scene presence's known regions here on this region |
1954 | sp.DropOldNeighbours(oldRegions); | 1956 | sp.DropOldNeighbours(oldRegions); |
@@ -2020,64 +2022,58 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2020 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); | 2022 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); |
2021 | //avatar.DumpKnownRegions(); | 2023 | //avatar.DumpKnownRegions(); |
2022 | 2024 | ||
2023 | bool newAgent = false; | 2025 | Util.FireAndForget(delegate |
2024 | int count = 0; | ||
2025 | bool delay = true; | ||
2026 | foreach (GridRegion neighbour in neighbours) | ||
2027 | { | 2026 | { |
2028 | //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); | 2027 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start |
2029 | // Don't do it if there's already an agent in that region | 2028 | int count = 0; |
2030 | if (newRegions.Contains(neighbour.RegionHandle)) | 2029 | bool newAgent = false; |
2031 | newAgent = true; | ||
2032 | else | ||
2033 | newAgent = false; | ||
2034 | // continue; | ||
2035 | 2030 | ||
2036 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 2031 | foreach (GridRegion neighbour in neighbours) |
2037 | { | 2032 | { |
2038 | try | 2033 | //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); |
2039 | { | 2034 | // Don't do it if there's already an agent in that region |
2040 | // Let's put this back at sync, so that it doesn't clog | 2035 | if (newRegions.Contains(neighbour.RegionHandle)) |
2041 | // the network, especially for regions in the same physical server. | 2036 | newAgent = true; |
2042 | // We're really not in a hurry here. | 2037 | else |
2043 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, delay); | 2038 | newAgent = false; |
2044 | delay = false; // ugly i know.. but there aren't that many neighbours | 2039 | // continue; |
2045 | |||
2046 | //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
2047 | //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | ||
2048 | // InformClientOfNeighbourCompleted, | ||
2049 | // d); | ||
2050 | } | ||
2051 | 2040 | ||
2052 | catch (ArgumentOutOfRangeException) | 2041 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) |
2053 | { | 2042 | { |
2054 | m_log.ErrorFormat( | 2043 | try |
2055 | "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | 2044 | { |
2056 | neighbour.ExternalHostName, | 2045 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); |
2057 | neighbour.RegionHandle, | 2046 | } |
2058 | neighbour.RegionLocX, | ||
2059 | neighbour.RegionLocY); | ||
2060 | } | ||
2061 | catch (Exception e) | ||
2062 | { | ||
2063 | m_log.ErrorFormat( | ||
2064 | "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
2065 | neighbour.ExternalHostName, | ||
2066 | neighbour.RegionHandle, | ||
2067 | neighbour.RegionLocX, | ||
2068 | neighbour.RegionLocY, | ||
2069 | e); | ||
2070 | |||
2071 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
2072 | // since I don't know what will happen if we just let the client continue | ||
2073 | |||
2074 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
2075 | // throw e; | ||
2076 | 2047 | ||
2048 | catch (ArgumentOutOfRangeException) | ||
2049 | { | ||
2050 | m_log.ErrorFormat( | ||
2051 | "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | ||
2052 | neighbour.ExternalHostName, | ||
2053 | neighbour.RegionHandle, | ||
2054 | neighbour.RegionLocX, | ||
2055 | neighbour.RegionLocY); | ||
2056 | } | ||
2057 | catch (Exception e) | ||
2058 | { | ||
2059 | m_log.ErrorFormat( | ||
2060 | "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
2061 | neighbour.ExternalHostName, | ||
2062 | neighbour.RegionHandle, | ||
2063 | neighbour.RegionLocX, | ||
2064 | neighbour.RegionLocY, | ||
2065 | e); | ||
2066 | |||
2067 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
2068 | // since I don't know what will happen if we just let the client continue | ||
2069 | |||
2070 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
2071 | // throw e; | ||
2072 | } | ||
2077 | } | 2073 | } |
2074 | count++; | ||
2078 | } | 2075 | } |
2079 | count++; | 2076 | }); |
2080 | } | ||
2081 | } | 2077 | } |
2082 | 2078 | ||
2083 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) | 2079 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) |
@@ -2109,14 +2105,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2109 | /// <param name="regionHandle"></param> | 2105 | /// <param name="regionHandle"></param> |
2110 | /// <param name="endPoint"></param> | 2106 | /// <param name="endPoint"></param> |
2111 | private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, | 2107 | private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, |
2112 | IPEndPoint endPoint, bool newAgent,bool doinitialdelay) | 2108 | IPEndPoint endPoint, bool newAgent) |
2113 | { | 2109 | { |
2114 | // Let's wait just a little to give time to originating regions to catch up with closing child agents | 2110 | Scene scene = sp.Scene; |
2115 | // after a cross here | ||
2116 | if(doinitialdelay) | ||
2117 | Thread.Sleep(500); | ||
2118 | |||
2119 | Scene scene = sp.Scene; | ||
2120 | 2111 | ||
2121 | m_log.DebugFormat( | 2112 | m_log.DebugFormat( |
2122 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", | 2113 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", |