diff options
Diffstat (limited to 'OpenSim/Region')
5 files changed, 136 insertions, 117 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 86d7f83..9090f64 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
220 | /// <param name="sp"></param> | 220 | /// <param name="sp"></param> |
221 | /// <param name="position"></param> | 221 | /// <param name="position"></param> |
222 | /// <param name="lookAt"></param> | 222 | /// <param name="lookAt"></param> |
223 | /// <param name="teleportFlags"></param | 223 | /// <param name="teleportFlags"></param> |
224 | private void TeleportAgentWithinRegion(ScenePresence sp, Vector3 position, Vector3 lookAt, uint teleportFlags) | 224 | private void TeleportAgentWithinRegion(ScenePresence sp, Vector3 position, Vector3 lookAt, uint teleportFlags) |
225 | { | 225 | { |
226 | m_log.DebugFormat( | 226 | m_log.DebugFormat( |
@@ -988,7 +988,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
988 | agent.IsInTransit = true; | 988 | agent.IsInTransit = true; |
989 | 989 | ||
990 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; | 990 | CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; |
991 | d.BeginInvoke(agent, newpos, x, y, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); | 991 | d.BeginInvoke(agent, newpos, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); |
992 | 992 | ||
993 | return true; | 993 | return true; |
994 | } | 994 | } |
@@ -1045,42 +1045,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1045 | icon.EndInvoke(iar); | 1045 | icon.EndInvoke(iar); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | public bool CrossAgentToNewRegionPrep(ScenePresence agent, GridRegion neighbourRegion) | ||
1049 | { | ||
1050 | if (neighbourRegion == null) | ||
1051 | return false; | ||
1052 | |||
1053 | m_entityTransferStateMachine.SetInTransit(agent.UUID); | ||
1054 | |||
1055 | agent.RemoveFromPhysicalScene(); | ||
1056 | |||
1057 | return true; | ||
1058 | } | ||
1059 | |||
1048 | /// <summary> | 1060 | /// <summary> |
1049 | /// This Closes child agents on neighbouring regions | 1061 | /// This Closes child agents on neighbouring regions |
1050 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 1062 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
1051 | /// </summary> | 1063 | /// </summary> |
1052 | public ScenePresence CrossAgentToNewRegionAsync( | 1064 | public ScenePresence CrossAgentToNewRegionAsync( |
1053 | ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, | 1065 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1054 | bool isFlying, string version) | 1066 | bool isFlying, string version) |
1055 | { | 1067 | { |
1056 | if (neighbourRegion == null) | 1068 | if (!CrossAgentToNewRegionPrep(agent, neighbourRegion)) |
1057 | return agent; | 1069 | return agent; |
1058 | 1070 | ||
1059 | try | 1071 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) |
1060 | { | 1072 | return agent; |
1061 | m_entityTransferStateMachine.SetInTransit(agent.UUID); | ||
1062 | |||
1063 | ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | ||
1064 | |||
1065 | m_log.DebugFormat( | ||
1066 | "[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", | ||
1067 | agent.Firstname, agent.Lastname, neighbourx, neighboury, version); | ||
1068 | |||
1069 | Scene m_scene = agent.Scene; | ||
1070 | |||
1071 | if (!agent.ValidateAttachments()) | ||
1072 | m_log.DebugFormat( | ||
1073 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.", | ||
1074 | agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName); | ||
1075 | |||
1076 | pos = pos + agent.Velocity; | ||
1077 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); | ||
1078 | 1073 | ||
1079 | agent.RemoveFromPhysicalScene(); | 1074 | CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version); |
1075 | return agent; | ||
1076 | } | ||
1080 | 1077 | ||
1078 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) | ||
1079 | { | ||
1080 | try | ||
1081 | { | ||
1081 | AgentData cAgent = new AgentData(); | 1082 | AgentData cAgent = new AgentData(); |
1082 | agent.CopyTo(cAgent); | 1083 | agent.CopyTo(cAgent); |
1083 | cAgent.Position = pos; | 1084 | cAgent.Position = pos + agent.Velocity; |
1084 | if (isFlying) | 1085 | if (isFlying) |
1085 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 1086 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
1086 | 1087 | ||
@@ -1090,7 +1091,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1090 | // Beyond this point, extra cleanup is needed beyond removing transit state | 1091 | // Beyond this point, extra cleanup is needed beyond removing transit state |
1091 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); | 1092 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); |
1092 | 1093 | ||
1093 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | 1094 | if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
1094 | { | 1095 | { |
1095 | // region doesn't take it | 1096 | // region doesn't take it |
1096 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1097 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
@@ -1099,93 +1100,108 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1099 | agent.AddToPhysicalScene(isFlying); | 1100 | agent.AddToPhysicalScene(isFlying); |
1100 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1101 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1101 | 1102 | ||
1102 | return agent; | 1103 | return false; |
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 1106 | } |
1106 | agent.ControllingClient.RequestClientInfo(); | 1107 | catch (Exception e) |
1108 | { | ||
1109 | m_log.ErrorFormat( | ||
1110 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", | ||
1111 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); | ||
1107 | 1112 | ||
1108 | //m_log.Debug("BEFORE CROSS"); | 1113 | // TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc. |
1109 | //Scene.DumpChildrenSeeds(UUID); | 1114 | return false; |
1110 | //DumpKnownRegions(); | 1115 | } |
1111 | string agentcaps; | ||
1112 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | ||
1113 | { | ||
1114 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | ||
1115 | neighbourRegion.RegionHandle); | ||
1116 | return agent; | ||
1117 | } | ||
1118 | // No turning back | ||
1119 | agent.IsChildAgent = true; | ||
1120 | 1116 | ||
1121 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | 1117 | return true; |
1118 | } | ||
1122 | 1119 | ||
1123 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1120 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1121 | bool isFlying, string version) | ||
1122 | { | ||
1123 | agent.ControllingClient.RequestClientInfo(); | ||
1124 | 1124 | ||
1125 | if (m_eqModule != null) | 1125 | string agentcaps; |
1126 | { | 1126 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) |
1127 | m_eqModule.CrossRegion( | 1127 | { |
1128 | neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, | 1128 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", |
1129 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | 1129 | neighbourRegion.RegionHandle); |
1130 | } | 1130 | return; |
1131 | else | 1131 | } |
1132 | { | ||
1133 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1134 | capsPath); | ||
1135 | } | ||
1136 | 1132 | ||
1137 | // SUCCESS! | 1133 | // No turning back |
1138 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | 1134 | agent.IsChildAgent = true; |
1139 | 1135 | ||
1140 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | 1136 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
1141 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | ||
1142 | 1137 | ||
1143 | agent.MakeChildAgent(); | 1138 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1144 | 1139 | ||
1145 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | 1140 | Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0); |
1146 | // but not sure yet what the side effects would be. | ||
1147 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | ||
1148 | 1141 | ||
1149 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1142 | if (m_eqModule != null) |
1150 | agent.SendOtherAgentsAvatarDataToMe(); | 1143 | { |
1151 | agent.SendOtherAgentsAppearanceToMe(); | 1144 | m_eqModule.CrossRegion( |
1145 | neighbourRegion.RegionHandle, pos + agent.Velocity, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint, | ||
1146 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1147 | } | ||
1148 | else | ||
1149 | { | ||
1150 | agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos + agent.Velocity, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1151 | capsPath); | ||
1152 | } | ||
1152 | 1153 | ||
1153 | // Backwards compatibility. Best effort | 1154 | // SUCCESS! |
1154 | if (version == "Unknown" || version == string.Empty) | 1155 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); |
1155 | { | ||
1156 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1157 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1158 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1159 | } | ||
1160 | 1156 | ||
1161 | // Next, let's close the child agent connections that are too far away. | 1157 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. |
1162 | agent.CloseChildAgents(neighbourx, neighboury); | 1158 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1163 | 1159 | ||
1164 | AgentHasMovedAway(agent, false); | 1160 | agent.MakeChildAgent(); |
1165 | 1161 | ||
1166 | // the user may change their profile information in other region, | 1162 | // FIXME: Possibly this should occur lower down after other commands to close other agents, |
1167 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1163 | // but not sure yet what the side effects would be. |
1168 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 1164 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1169 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | 1165 | |
1170 | { | 1166 | // now we have a child agent in this region. Request all interesting data about other (root) agents |
1171 | m_log.DebugFormat( | 1167 | agent.SendOtherAgentsAvatarDataToMe(); |
1172 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | 1168 | agent.SendOtherAgentsAppearanceToMe(); |
1173 | } | 1169 | |
1174 | 1170 | // Backwards compatibility. Best effort | |
1175 | //m_log.Debug("AFTER CROSS"); | 1171 | if (version == "Unknown" || version == string.Empty) |
1176 | //Scene.DumpChildrenSeeds(UUID); | ||
1177 | //DumpKnownRegions(); | ||
1178 | } | ||
1179 | catch (Exception e) | ||
1180 | { | 1172 | { |
1181 | m_log.ErrorFormat( | 1173 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); |
1182 | "[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}", | 1174 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback |
1183 | agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); | 1175 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); |
1176 | } | ||
1184 | 1177 | ||
1185 | // TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc. | 1178 | // Next, let's close the child agent connections that are too far away. |
1179 | uint neighbourx; | ||
1180 | uint neighboury; | ||
1181 | |||
1182 | Utils.LongToUInts(neighbourRegion.RegionHandle, out neighbourx, out neighboury); | ||
1183 | |||
1184 | neighbourx /= Constants.RegionSize; | ||
1185 | neighboury /= Constants.RegionSize; | ||
1186 | |||
1187 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1188 | |||
1189 | AgentHasMovedAway(agent, false); | ||
1190 | |||
1191 | // the user may change their profile information in other region, | ||
1192 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1193 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1194 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1195 | { | ||
1196 | m_log.DebugFormat( | ||
1197 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1186 | } | 1198 | } |
1187 | 1199 | ||
1188 | return agent; | 1200 | //m_log.Debug("AFTER CROSS"); |
1201 | //Scene.DumpChildrenSeeds(UUID); | ||
1202 | //DumpKnownRegions(); | ||
1203 | |||
1204 | return; | ||
1189 | } | 1205 | } |
1190 | 1206 | ||
1191 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 1207 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index e0e358a..13762f7 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -188,9 +188,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
188 | args.Type = PollServiceEventArgs.EventType.LslHttp; | 188 | args.Type = PollServiceEventArgs.EventType.LslHttp; |
189 | m_HttpServer.AddPollServiceHTTPHandler(uri, args); | 189 | m_HttpServer.AddPollServiceHTTPHandler(uri, args); |
190 | 190 | ||
191 | m_log.DebugFormat( | 191 | // m_log.DebugFormat( |
192 | "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}", | 192 | // "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}", |
193 | uri, itemID, host.Name, host.LocalId); | 193 | // uri, itemID, host.Name, host.LocalId); |
194 | 194 | ||
195 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); | 195 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); |
196 | } | 196 | } |
@@ -234,9 +234,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
234 | args.Type = PollServiceEventArgs.EventType.LslHttp; | 234 | args.Type = PollServiceEventArgs.EventType.LslHttp; |
235 | m_HttpsServer.AddPollServiceHTTPHandler(uri, args); | 235 | m_HttpsServer.AddPollServiceHTTPHandler(uri, args); |
236 | 236 | ||
237 | m_log.DebugFormat( | 237 | // m_log.DebugFormat( |
238 | "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", | 238 | // "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", |
239 | uri, itemID, host.Name, host.LocalId); | 239 | // uri, itemID, host.Name, host.LocalId); |
240 | 240 | ||
241 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); | 241 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); |
242 | } | 242 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 5bc8e51..1949a90 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -35,7 +35,7 @@ using OpenSim.Region.Framework.Scenes; | |||
35 | 35 | ||
36 | namespace OpenSim.Region.Framework.Interfaces | 36 | namespace OpenSim.Region.Framework.Interfaces |
37 | { | 37 | { |
38 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version); | 38 | public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); |
39 | 39 | ||
40 | public interface IEntityTransferModule | 40 | public interface IEntityTransferModule |
41 | { | 41 | { |
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
76 | 76 | ||
77 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); | 77 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); |
78 | 78 | ||
79 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version); | 79 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bc0f5b6..4798481 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -581,7 +581,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
581 | av.IsInTransit = true; | 581 | av.IsInTransit = true; |
582 | 582 | ||
583 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | 583 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; |
584 | d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | 584 | d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); |
585 | } | 585 | } |
586 | else | 586 | else |
587 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); | 587 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 20919a1..756b1f4 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -438,23 +438,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
438 | } | 438 | } |
439 | 439 | ||
440 | // Extra statistics that aren't currently sent to clients | 440 | // Extra statistics that aren't currently sent to clients |
441 | lock (m_lastReportedExtraSimStats) | 441 | if (m_scene.PhysicsScene != null) |
442 | { | 442 | { |
443 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; | 443 | lock (m_lastReportedExtraSimStats) |
444 | |||
445 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | ||
446 | |||
447 | if (physicsStats != null) | ||
448 | { | 444 | { |
449 | foreach (KeyValuePair<string, float> tuple in physicsStats) | 445 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; |
446 | |||
447 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | ||
448 | |||
449 | if (physicsStats != null) | ||
450 | { | 450 | { |
451 | // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second | 451 | foreach (KeyValuePair<string, float> tuple in physicsStats) |
452 | // Need to change things so that stats source can indicate whether they are per second or | 452 | { |
453 | // per frame. | 453 | // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second |
454 | if (tuple.Key.EndsWith("MS")) | 454 | // Need to change things so that stats source can indicate whether they are per second or |
455 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe; | 455 | // per frame. |
456 | else | 456 | if (tuple.Key.EndsWith("MS")) |
457 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; | 457 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe; |
458 | else | ||
459 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; | ||
460 | } | ||
458 | } | 461 | } |
459 | } | 462 | } |
460 | } | 463 | } |