aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorubit2012-09-06 18:58:57 +0200
committerubit2012-09-06 18:58:57 +0200
commit402de5fb78b8115ff6e7bd1fdfe0e63e71352967 (patch)
treedc35c801311287bf27e9f8e78f36ef7bd565bf25 /OpenSim/Region/CoreModules
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentMerge branch 'ubitwork' into avination (diff)
downloadopensim-SC_OLD-402de5fb78b8115ff6e7bd1fdfe0e63e71352967.zip
opensim-SC_OLD-402de5fb78b8115ff6e7bd1fdfe0e63e71352967.tar.gz
opensim-SC_OLD-402de5fb78b8115ff6e7bd1fdfe0e63e71352967.tar.bz2
opensim-SC_OLD-402de5fb78b8115ff6e7bd1fdfe0e63e71352967.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs204
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs12
2 files changed, 116 insertions, 100 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 }