diff options
author | Tleiades Hax | 2007-10-18 15:10:43 +0000 |
---|---|---|
committer | Tleiades Hax | 2007-10-18 15:10:43 +0000 |
commit | 05df8571323c535b5c1ce1b0532e88236b143b7e (patch) | |
tree | 6f275d5b682231906315363514e98b7b06557fda /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | * Removed some comments (diff) | |
download | opensim-SC_OLD-05df8571323c535b5c1ce1b0532e88236b143b7e.zip opensim-SC_OLD-05df8571323c535b5c1ce1b0532e88236b143b7e.tar.gz opensim-SC_OLD-05df8571323c535b5c1ce1b0532e88236b143b7e.tar.bz2 opensim-SC_OLD-05df8571323c535b5c1ce1b0532e88236b143b7e.tar.xz |
Possible fix for: Remoting exceptions with adjacent non-running sims.
Bugs 449, 454, 408, 244, 197
implemented InformClientOfNeighbours as an asynchroneous process, handling timeouts without blocking the main thread.
Improved logging of errors, removed catch all in try catch
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b0f0b9a..ab8a48a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Net; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Threading; | 32 | using System.Threading; |
@@ -529,7 +530,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
529 | public virtual void LoadPrimsFromStorage() | 530 | public virtual void LoadPrimsFromStorage() |
530 | { | 531 | { |
531 | MainLog.Instance.Verbose("Loading objects from datastore"); | 532 | MainLog.Instance.Verbose("Loading objects from datastore"); |
532 | List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.SimUUID); | 533 | List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.RegionID); |
533 | foreach (SceneObjectGroup prim in PrimsFromDB) | 534 | foreach (SceneObjectGroup prim in PrimsFromDB) |
534 | { | 535 | { |
535 | AddEntityFromStorage(prim); | 536 | AddEntityFromStorage(prim); |
@@ -964,7 +965,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
964 | if (Entities.ContainsKey(entID)) | 965 | if (Entities.ContainsKey(entID)) |
965 | { | 966 | { |
966 | Entities.Remove(entID); | 967 | Entities.Remove(entID); |
967 | storageManager.DataStore.RemoveObject(entID, m_regInfo.SimUUID); | 968 | storageManager.DataStore.RemoveObject(entID, m_regInfo.RegionID); |
968 | return true; | 969 | return true; |
969 | } | 970 | } |
970 | return false; | 971 | return false; |
@@ -1062,13 +1063,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
1062 | } | 1063 | } |
1063 | } | 1064 | } |
1064 | 1065 | ||
1066 | delegate void InformClientOfNeighbourDelegate(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); | ||
1067 | |||
1068 | /// <summary> | ||
1069 | /// Async compnent for informing client of which neighbours exists | ||
1070 | /// </summary> | ||
1071 | /// <remarks> | ||
1072 | /// This needs to run asynchronesously, as a network timeout may block the thread for a long while | ||
1073 | /// </remarks> | ||
1074 | /// <param name="remoteClient"></param> | ||
1075 | /// <param name="a"></param> | ||
1076 | /// <param name="regionHandle"></param> | ||
1077 | /// <param name="endPoint"></param> | ||
1078 | public void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint) | ||
1079 | { | ||
1080 | bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a); | ||
1081 | |||
1082 | if (regionAccepted) | ||
1083 | remoteClient.InformClientOfNeighbour(regionHandle, endPoint); | ||
1084 | } | ||
1085 | |||
1065 | /// <summary> | 1086 | /// <summary> |
1066 | /// | 1087 | /// |
1067 | /// </summary> | 1088 | /// </summary> |
1068 | public void InformClientOfNeighbours(IClientAPI remoteClient) | 1089 | public void InformClientOfNeighbours(IClientAPI remoteClient) |
1069 | { | 1090 | { |
1070 | List<RegionInfo> neighbours = commsManager.GridService.RequestNeighbours(m_regInfo); | 1091 | List<SimpleRegionInfo> neighbours = commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY); |
1071 | |||
1072 | if (neighbours != null) | 1092 | if (neighbours != null) |
1073 | { | 1093 | { |
1074 | for (int i = 0; i < neighbours.Count; i++) | 1094 | for (int i = 0; i < neighbours.Count; i++) |
@@ -1078,8 +1098,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1078 | agent.InventoryFolder = LLUUID.Zero; | 1098 | agent.InventoryFolder = LLUUID.Zero; |
1079 | agent.startpos = new LLVector3(128, 128, 70); | 1099 | agent.startpos = new LLVector3(128, 128, 70); |
1080 | agent.child = true; | 1100 | agent.child = true; |
1081 | commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); | 1101 | |
1082 | remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint); | 1102 | InformClientOfNeighbourDelegate d = new InformClientOfNeighbourDelegate(InformClientOfNeighbourAsync); |
1103 | IAsyncResult asyncInform = d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint, null, null); | ||
1083 | //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); | 1104 | //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); |
1084 | } | 1105 | } |
1085 | } | 1106 | } |