aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs3
-rw-r--r--OpenSim/Region/Application/Application.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs44
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs57
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs210
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs134
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs5
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs68
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs21
20 files changed, 394 insertions, 236 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index e45cb89..7384e39 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1618,7 +1618,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1618 m_httpListener2.Start(64); 1618 m_httpListener2.Start(64);
1619 1619
1620 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events 1620 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
1621 m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); 1621// m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
1622 m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000);
1622 HTTPDRunning = true; 1623 HTTPDRunning = true;
1623 1624
1624 //HttpListenerContext context; 1625 //HttpListenerContext context;
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index ebfebc4..78636c4 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Net;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
32using log4net.Config; 33using log4net.Config;
@@ -73,6 +74,7 @@ namespace OpenSim
73 AppDomain.CurrentDomain.UnhandledException += 74 AppDomain.CurrentDomain.UnhandledException +=
74 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 75 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
75 76
77 ServicePointManager.DefaultConnectionLimit = 6;
76 78
77 // Add the arguments supplied when running the application to the configuration 79 // Add the arguments supplied when running the application to the configuration
78 ArgvConfigSource configSource = new ArgvConfigSource(args); 80 ArgvConfigSource configSource = new ArgvConfigSource(args);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index b9222e3..7dcf137 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -151,6 +151,12 @@ namespace OpenSim.Region.ClientStack.Linden
151 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 151 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
152 uint locationID, uint flags, string capsURL, UUID agentID) 152 uint locationID, uint flags, string capsURL, UUID agentID)
153 { 153 {
154 // not sure why flags get overwritten here
155 if ((flags & (uint)TeleportFlags.IsFlying) != 0)
156 flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying;
157 else
158 flags = (uint)TeleportFlags.ViaLocation;
159
154 OSDMap info = new OSDMap(); 160 OSDMap info = new OSDMap();
155 info.Add("AgentID", OSD.FromUUID(agentID)); 161 info.Add("AgentID", OSD.FromUUID(agentID));
156 info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? 162 info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this?
@@ -159,7 +165,8 @@ namespace OpenSim.Region.ClientStack.Linden
159 info.Add("SimAccess", OSD.FromInteger(simAccess)); 165 info.Add("SimAccess", OSD.FromInteger(simAccess));
160 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); 166 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
161 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); 167 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
162 info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation 168// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
169 info.Add("TeleportFlags", OSD.FromUInteger(flags));
163 170
164 OSDArray infoArr = new OSDArray(); 171 OSDArray infoArr = new OSDArray();
165 infoArr.Add(info); 172 infoArr.Add(info);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index b77ead3..e996fe8 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -60,11 +60,11 @@ namespace OpenSim.Region.ClientStack.Linden
60 60
61 private WebFetchInvDescHandler m_webFetchHandler; 61 private WebFetchInvDescHandler m_webFetchHandler;
62 62
63 private ManualResetEvent m_ev = new ManualResetEvent(true);
64 private object m_lock = new object(); 63 private object m_lock = new object();
65 64
66 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 65 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
67 private Dictionary<UUID, Hashtable> m_requests = new Dictionary<UUID, Hashtable>(); 66 private Dictionary<UUID, Hashtable> m_requests = new Dictionary<UUID, Hashtable>();
67 bool m_busy = false;
68 68
69 #region ISharedRegionModule Members 69 #region ISharedRegionModule Members
70 70
@@ -116,7 +116,9 @@ namespace OpenSim.Region.ClientStack.Linden
116 string capUrl = "/CAPS/" + UUID.Random() + "/"; 116 string capUrl = "/CAPS/" + UUID.Random() + "/";
117 117
118 // Register this as a poll service 118 // Register this as a poll service
119 // absurd large timeout to tune later to make a bit less than viewer
119 PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000); 120 PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000);
121
120 args.Type = PollServiceEventArgs.EventType.Inventory; 122 args.Type = PollServiceEventArgs.EventType.Inventory;
121 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); 123 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
122 124
@@ -133,6 +135,8 @@ namespace OpenSim.Region.ClientStack.Linden
133 caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); 135 caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
134 136
135 m_capsDict[agentID] = capUrl; 137 m_capsDict[agentID] = capUrl;
138
139 m_busy = false;
136 } 140 }
137 141
138 private void DeregisterCaps(UUID agentID, Caps caps) 142 private void DeregisterCaps(UUID agentID, Caps caps)
@@ -149,25 +153,22 @@ namespace OpenSim.Region.ClientStack.Linden
149 public void HttpRequestHandler(UUID requestID, Hashtable request) 153 public void HttpRequestHandler(UUID requestID, Hashtable request)
150 { 154 {
151// m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); 155// m_log.DebugFormat("[FETCH2]: Received request {0}", requestID);
152 m_requests[requestID] = request; 156 lock(m_lock)
157 m_requests[requestID] = request;
153 } 158 }
154 159
155 private bool HasEvents(UUID requestID, UUID sessionID) 160 private bool HasEvents(UUID requestID, UUID sessionID)
156 { 161 {
157 lock (m_lock) 162 lock (m_lock)
158 { 163 {
159 if (m_ev.WaitOne(0)) 164 return !m_busy;
160 {
161 m_ev.Reset();
162 return true;
163 }
164 return false;
165 } 165 }
166 } 166 }
167 167
168 private Hashtable NoEvents(UUID requestID, UUID sessionID) 168 private Hashtable NoEvents(UUID requestID, UUID sessionID)
169 { 169 {
170 m_requests.Remove(requestID); 170 lock(m_lock)
171 m_requests.Remove(requestID);
171 172
172 Hashtable response = new Hashtable(); 173 Hashtable response = new Hashtable();
173 174
@@ -177,11 +178,17 @@ namespace OpenSim.Region.ClientStack.Linden
177 response["keepalive"] = false; 178 response["keepalive"] = false;
178 response["reusecontext"] = false; 179 response["reusecontext"] = false;
179 180
181 lock (m_lock)
182 m_busy = false;
183
180 return response; 184 return response;
181 } 185 }
182 186
183 private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) 187 private Hashtable GetEvents(UUID requestID, UUID sessionID, string request)
184 { 188 {
189 lock (m_lock)
190 m_busy = true;
191
185 Hashtable response = new Hashtable(); 192 Hashtable response = new Hashtable();
186 193
187 response["int_response_code"] = 500; 194 response["int_response_code"] = 500;
@@ -192,20 +199,23 @@ namespace OpenSim.Region.ClientStack.Linden
192 199
193 try 200 try
194 { 201 {
202
195 Hashtable requestHash; 203 Hashtable requestHash;
196 if (!m_requests.TryGetValue(requestID, out requestHash)) 204 lock (m_lock)
197 { 205 {
198 lock (m_lock) 206 if (!m_requests.TryGetValue(requestID, out requestHash))
199 m_ev.Set(); 207 {
200 response["str_response_string"] = "Invalid request"; 208 m_busy = false;
201 return response; 209 response["str_response_string"] = "Invalid request";
210 return response;
211 }
212 m_requests.Remove(requestID);
202 } 213 }
203 214
204// m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); 215// m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID);
205 216
206 string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); 217 string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null);
207 218
208 m_requests.Remove(requestID);
209 219
210 response["int_response_code"] = 200; 220 response["int_response_code"] = 200;
211 response["str_response_string"] = reply; 221 response["str_response_string"] = reply;
@@ -213,7 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden
213 finally 223 finally
214 { 224 {
215 lock (m_lock) 225 lock (m_lock)
216 m_ev.Set(); 226 m_busy = false;
217 } 227 }
218 228
219 return response; 229 return response;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 7e51638..74b27d7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -807,7 +807,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
807 handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); 807 handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType);
808 handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; 808 handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes;
809 809
810 OutPacket(handshake, ThrottleOutPacketType.Task); 810// OutPacket(handshake, ThrottleOutPacketType.Task);
811 // use same as MoveAgentIntoRegion (both should be task )
812 OutPacket(handshake, ThrottleOutPacketType.Unknown);
811 } 813 }
812 814
813 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 815 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
@@ -8748,16 +8750,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8748 8750
8749 #region Parcel related packets 8751 #region Parcel related packets
8750 8752
8753 // acumulate several HandleRegionHandleRequest consecutive overlaping requests
8754 // to be done with minimal resources as possible
8755 // variables temporary here while in test
8756
8757 Queue<UUID> RegionHandleRequests = new Queue<UUID>();
8758 bool RegionHandleRequestsInService = false;
8759
8751 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) 8760 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
8752 { 8761 {
8753 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 8762 UUID currentUUID;
8754 8763
8755 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; 8764 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
8756 if (handlerRegionHandleRequest != null) 8765
8766 if (handlerRegionHandleRequest == null)
8767 return true;
8768
8769 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
8770
8771 lock (RegionHandleRequests)
8772 {
8773 if (RegionHandleRequestsInService)
8774 {
8775 // we are already busy doing a previus request
8776 // so enqueue it
8777 RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID);
8778 return true;
8779 }
8780
8781 // else do it
8782 currentUUID = rhrPack.RequestBlock.RegionID;
8783 RegionHandleRequestsInService = true;
8784 }
8785
8786 while (true)
8757 { 8787 {
8758 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); 8788 handlerRegionHandleRequest(this, currentUUID);
8789
8790 lock (RegionHandleRequests)
8791 {
8792 // exit condition, nothing to do or closed
8793 // current code seems to assume we may loose the handler at anytime,
8794 // so keep checking it
8795 handlerRegionHandleRequest = OnRegionHandleRequest;
8796
8797 if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null)
8798 {
8799 RegionHandleRequests.Clear();
8800 RegionHandleRequestsInService = false;
8801 return true;
8802 }
8803 currentUUID = RegionHandleRequests.Dequeue();
8804 }
8759 } 8805 }
8760 return true; 8806
8807 return true; // actually unreached
8761 } 8808 }
8762 8809
8763 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) 8810 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 1406aae..0c067d7 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -137,6 +137,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
137 { 137 {
138 UUID toAgentID = new UUID(im.toAgentID); 138 UUID toAgentID = new UUID(im.toAgentID);
139 139
140 if (toAgentID == UUID.Zero)
141 return;
142
140 // Try root avatar only first 143 // Try root avatar only first
141 foreach (Scene scene in m_Scenes) 144 foreach (Scene scene in m_Scenes)
142 { 145 {
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 538dd5f..486f9d2 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(
@@ -264,6 +264,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
264 position.Z = newPosZ; 264 position.Z = newPosZ;
265 } 265 }
266 266
267 if (sp.Flying)
268 teleportFlags |= (uint)TeleportFlags.IsFlying;
269
267 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 270 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
268 271
269 sp.ControllingClient.SendTeleportStart(teleportFlags); 272 sp.ControllingClient.SendTeleportStart(teleportFlags);
@@ -471,6 +474,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
471 if (sp.ParentID != (uint)0) 474 if (sp.ParentID != (uint)0)
472 sp.StandUp(); 475 sp.StandUp();
473 476
477 else if (sp.Flying)
478 teleportFlags |= (uint)TeleportFlags.IsFlying;
479
474 sp.ControllingClient.SendTeleportStart(teleportFlags); 480 sp.ControllingClient.SendTeleportStart(teleportFlags);
475 481
476 // the avatar.Close below will clear the child region list. We need this below for (possibly) 482 // the avatar.Close below will clear the child region list. We need this below for (possibly)
@@ -982,7 +988,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
982 agent.IsInTransit = true; 988 agent.IsInTransit = true;
983 989
984 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; 990 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
985 d.BeginInvoke(agent, newpos, x, y, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); 991 d.BeginInvoke(agent, newpos, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
986 992
987 return true; 993 return true;
988 } 994 }
@@ -1039,42 +1045,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1039 icon.EndInvoke(iar); 1045 icon.EndInvoke(iar);
1040 } 1046 }
1041 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
1042 /// <summary> 1060 /// <summary>
1043 /// This Closes child agents on neighbouring regions 1061 /// This Closes child agents on neighbouring regions
1044 /// 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.
1045 /// </summary> 1063 /// </summary>
1046 public ScenePresence CrossAgentToNewRegionAsync( 1064 public ScenePresence CrossAgentToNewRegionAsync(
1047 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, 1065 ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1048 bool isFlying, string version) 1066 bool isFlying, string version)
1049 { 1067 {
1050 if (neighbourRegion == null) 1068 if (!CrossAgentToNewRegionPrep(agent, neighbourRegion))
1051 return agent; 1069 return agent;
1052 1070
1053 try 1071 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying))
1054 { 1072 return agent;
1055 m_entityTransferStateMachine.SetInTransit(agent.UUID);
1056
1057 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
1058
1059 m_log.DebugFormat(
1060 "[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}",
1061 agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
1062
1063 Scene m_scene = agent.Scene;
1064
1065 if (!agent.ValidateAttachments())
1066 m_log.DebugFormat(
1067 "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
1068 agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
1069
1070 pos = pos + agent.Velocity;
1071 Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
1072 1073
1073 agent.RemoveFromPhysicalScene(); 1074 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version);
1075 return agent;
1076 }
1074 1077
1078 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying)
1079 {
1080 try
1081 {
1075 AgentData cAgent = new AgentData(); 1082 AgentData cAgent = new AgentData();
1076 agent.CopyTo(cAgent); 1083 agent.CopyTo(cAgent);
1077 cAgent.Position = pos; 1084 cAgent.Position = pos + agent.Velocity;
1078 if (isFlying) 1085 if (isFlying)
1079 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1086 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
1080 1087
@@ -1084,7 +1091,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1084 // Beyond this point, extra cleanup is needed beyond removing transit state 1091 // Beyond this point, extra cleanup is needed beyond removing transit state
1085 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring); 1092 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
1086 1093
1087 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) 1094 if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
1088 { 1095 {
1089 // region doesn't take it 1096 // region doesn't take it
1090 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); 1097 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
@@ -1093,93 +1100,108 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1093 agent.AddToPhysicalScene(isFlying); 1100 agent.AddToPhysicalScene(isFlying);
1094 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1101 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1095 1102
1096 return agent; 1103 return false;
1097 } 1104 }
1098 1105
1099 //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); 1106 }
1100 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);
1112
1113 // TODO: Might be worth attempting other restoration here such as reinstantiation of scripts, etc.
1114 return false;
1115 }
1116
1117 return true;
1118 }
1101 1119
1102 //m_log.Debug("BEFORE CROSS"); 1120 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1103 //Scene.DumpChildrenSeeds(UUID); 1121 bool isFlying, string version)
1104 //DumpKnownRegions(); 1122 {
1105 string agentcaps; 1123 agent.ControllingClient.RequestClientInfo();
1106 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
1107 {
1108 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
1109 neighbourRegion.RegionHandle);
1110 return agent;
1111 }
1112 // No turning back
1113 agent.IsChildAgent = true;
1114 1124
1115 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); 1125 string agentcaps;
1126 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
1127 {
1128 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
1129 neighbourRegion.RegionHandle);
1130 return;
1131 }
1116 1132
1117 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 1133 // No turning back
1134 agent.IsChildAgent = true;
1118 1135
1119 if (m_eqModule != null) 1136 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
1120 {
1121 m_eqModule.CrossRegion(
1122 neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
1123 capsPath, agent.UUID, agent.ControllingClient.SessionId);
1124 }
1125 else
1126 {
1127 agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
1128 capsPath);
1129 }
1130 1137
1131 // SUCCESS! 1138 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
1132 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
1133 1139
1134 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. 1140 Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
1135 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
1136 1141
1137 agent.MakeChildAgent(); 1142 if (m_eqModule != null)
1143 {
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 }
1138 1153
1139 // FIXME: Possibly this should occur lower down after other commands to close other agents, 1154 // SUCCESS!
1140 // but not sure yet what the side effects would be. 1155 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
1141 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1142 1156
1143 // now we have a child agent in this region. Request all interesting data about other (root) agents 1157 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
1144 agent.SendOtherAgentsAvatarDataToMe(); 1158 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
1145 agent.SendOtherAgentsAppearanceToMe();
1146 1159
1147 // Backwards compatibility. Best effort 1160 agent.MakeChildAgent();
1148 if (version == "Unknown" || version == string.Empty)
1149 {
1150 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1151 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
1152 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1153 }
1154 1161
1155 // Next, let's close the child agent connections that are too far away. 1162 // FIXME: Possibly this should occur lower down after other commands to close other agents,
1156 agent.CloseChildAgents(neighbourx, neighboury); 1163 // but not sure yet what the side effects would be.
1164 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1157 1165
1158 AgentHasMovedAway(agent, false); 1166 // now we have a child agent in this region. Request all interesting data about other (root) agents
1167 agent.SendOtherAgentsAvatarDataToMe();
1168 agent.SendOtherAgentsAppearanceToMe();
1159 1169
1160 // the user may change their profile information in other region, 1170 // Backwards compatibility. Best effort
1161 // so the userinfo in UserProfileCache is not reliable any more, delete it 1171 if (version == "Unknown" || version == string.Empty)
1162 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1163 if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1164 {
1165 m_log.DebugFormat(
1166 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1167 }
1168
1169 //m_log.Debug("AFTER CROSS");
1170 //Scene.DumpChildrenSeeds(UUID);
1171 //DumpKnownRegions();
1172 }
1173 catch (Exception e)
1174 { 1172 {
1175 m_log.ErrorFormat( 1173 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1176 "[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
1177 agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace); 1175 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1176 }
1178 1177
1179 // 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);
1180 } 1198 }
1181 1199
1182 return agent; 1200 //m_log.Debug("AFTER CROSS");
1201 //Scene.DumpChildrenSeeds(UUID);
1202 //DumpKnownRegions();
1203
1204 return;
1183 } 1205 }
1184 1206
1185 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 32a4c88..99ffbe7 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -189,9 +189,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
189 args.Type = PollServiceEventArgs.EventType.LslHttp; 189 args.Type = PollServiceEventArgs.EventType.LslHttp;
190 m_HttpServer.AddPollServiceHTTPHandler(uri, args); 190 m_HttpServer.AddPollServiceHTTPHandler(uri, args);
191 191
192 m_log.DebugFormat( 192// m_log.DebugFormat(
193 "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}", 193// "[URL MODULE]: Set up incoming request url {0} for {1} in {2} {3}",
194 uri, itemID, host.Name, host.LocalId); 194// uri, itemID, host.Name, host.LocalId);
195 195
196 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); 196 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
197 } 197 }
@@ -235,9 +235,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
235 args.Type = PollServiceEventArgs.EventType.LslHttp; 235 args.Type = PollServiceEventArgs.EventType.LslHttp;
236 m_HttpsServer.AddPollServiceHTTPHandler(uri, args); 236 m_HttpsServer.AddPollServiceHTTPHandler(uri, args);
237 237
238 m_log.DebugFormat( 238// m_log.DebugFormat(
239 "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}", 239// "[URL MODULE]: Set up incoming secure request url {0} for {1} in {2} {3}",
240 uri, itemID, host.Name, host.LocalId); 240// uri, itemID, host.Name, host.LocalId);
241 241
242 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url }); 242 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_GRANTED", url });
243 } 243 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 51dcb67..aae6603 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -86,7 +86,10 @@ namespace OpenSim.Region.CoreModules.World.Land
86 /// <value> 86 /// <value>
87 /// Land objects keyed by local id 87 /// Land objects keyed by local id
88 /// </value> 88 /// </value>
89 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 89// private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
90
91 //ubit: removed the readonly so i can move it around
92 private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
90 93
91 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 94 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
92 95
@@ -242,15 +245,19 @@ namespace OpenSim.Region.CoreModules.World.Land
242 { 245 {
243 LandData newData = data.Copy(); 246 LandData newData = data.Copy();
244 newData.LocalID = local_id; 247 newData.LocalID = local_id;
248 ILandObject landobj = null;
245 249
246 lock (m_landList) 250 lock (m_landList)
247 { 251 {
248 if (m_landList.ContainsKey(local_id)) 252 if (m_landList.ContainsKey(local_id))
249 { 253 {
250 m_landList[local_id].LandData = newData; 254 m_landList[local_id].LandData = newData;
251 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); 255 landobj = m_landList[local_id];
256// m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
252 } 257 }
253 } 258 }
259 if(landobj != null)
260 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landobj);
254 } 261 }
255 262
256 public bool AllowedForcefulBans 263 public bool AllowedForcefulBans
@@ -280,14 +287,14 @@ namespace OpenSim.Region.CoreModules.World.Land
280 protected ILandObject CreateDefaultParcel() 287 protected ILandObject CreateDefaultParcel()
281 { 288 {
282 m_log.DebugFormat( 289 m_log.DebugFormat(
283 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); 290 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
284 291
285 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 292 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
286 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 293 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
287 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 294 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
288 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); 295 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
289 296
290 return AddLandObject(fullSimParcel); 297 return AddLandObject(fullSimParcel);
291 } 298 }
292 299
293 public List<ILandObject> AllParcels() 300 public List<ILandObject> AllParcels()
@@ -394,30 +401,51 @@ namespace OpenSim.Region.CoreModules.World.Land
394 401
395 public void SendLandUpdate(ScenePresence avatar, bool force) 402 public void SendLandUpdate(ScenePresence avatar, bool force)
396 { 403 {
404
405 /* stop sendind same data twice
406 ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
407 (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
408
409 if (over != null)
410 {
411
412 if (force)
413 {
414 if (!avatar.IsChildAgent)
415 {
416 over.SendLandUpdateToClient(avatar.ControllingClient);
417 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
418 m_scene.RegionInfo.RegionID);
419 }
420 }
421
422 if (avatar.currentParcelUUID != over.LandData.GlobalID)
423 {
424 if (!avatar.IsChildAgent)
425 {
426 over.SendLandUpdateToClient(avatar.ControllingClient);
427 avatar.currentParcelUUID = over.LandData.GlobalID;
428 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
429 m_scene.RegionInfo.RegionID);
430 }
431 }
432 */
433 if (avatar.IsChildAgent)
434 return;
435
397 ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 436 ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
398 (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 437 (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
399 438
400 if (over != null) 439 if (over != null)
401 { 440 {
402 if (force) 441 bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID);
403 { 442 if (force || NotsameID)
404 if (!avatar.IsChildAgent)
405 {
406 over.SendLandUpdateToClient(avatar.ControllingClient);
407 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
408 m_scene.RegionInfo.RegionID);
409 }
410 }
411
412 if (avatar.currentParcelUUID != over.LandData.GlobalID)
413 { 443 {
414 if (!avatar.IsChildAgent) 444 over.SendLandUpdateToClient(avatar.ControllingClient);
415 { 445 if (NotsameID)
416 over.SendLandUpdateToClient(avatar.ControllingClient);
417 avatar.currentParcelUUID = over.LandData.GlobalID; 446 avatar.currentParcelUUID = over.LandData.GlobalID;
418 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, 447 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
419 m_scene.RegionInfo.RegionID); 448 m_scene.RegionInfo.RegionID);
420 }
421 } 449 }
422 } 450 }
423 } 451 }
@@ -617,21 +645,28 @@ namespace OpenSim.Region.CoreModules.World.Land
617 /// </summary> 645 /// </summary>
618 public void Clear(bool setupDefaultParcel) 646 public void Clear(bool setupDefaultParcel)
619 { 647 {
648 Dictionary<int, ILandObject> landworkList;
649 // move to work pointer since we are deleting it all
620 lock (m_landList) 650 lock (m_landList)
621 { 651 {
622 foreach (ILandObject lo in m_landList.Values) 652 landworkList = m_landList;
623 { 653 m_landList = new Dictionary<int, ILandObject>();
624 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); 654 }
625 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
626 }
627 655
628 m_landList.Clear(); 656 // this 2 methods have locks (now)
657 ResetSimLandObjects();
629 658
630 ResetSimLandObjects(); 659 if (setupDefaultParcel)
660 CreateDefaultParcel();
631 661
632 if (setupDefaultParcel) 662 // fire outside events unlocked
633 CreateDefaultParcel(); 663 foreach (ILandObject lo in landworkList.Values)
664 {
665 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID);
666 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
634 } 667 }
668 landworkList.Clear();
669
635 } 670 }
636 671
637 private void performFinalLandJoin(ILandObject master, ILandObject slave) 672 private void performFinalLandJoin(ILandObject master, ILandObject slave)
@@ -1324,20 +1359,30 @@ namespace OpenSim.Region.CoreModules.World.Land
1324 1359
1325 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1360 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1326 { 1361 {
1362 Dictionary<int, ILandObject> landworkList;
1363 // move to work pointer since we are deleting it all
1364 lock (m_landList)
1365 {
1366 landworkList = m_landList;
1367 m_landList = new Dictionary<int, ILandObject>();
1368 }
1369
1370 //Remove all the land objects in the sim and then process our new data
1371 foreach (int n in landworkList.Keys)
1372 {
1373 m_scene.EventManager.TriggerLandObjectRemoved(landworkList[n].LandData.GlobalID);
1374 }
1375 landworkList.Clear();
1376
1327 lock (m_landList) 1377 lock (m_landList)
1328 { 1378 {
1329 //Remove all the land objects in the sim and then process our new data
1330 foreach (int n in m_landList.Keys)
1331 {
1332 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1333 }
1334 m_landIDList.Initialize(); 1379 m_landIDList.Initialize();
1335 m_landList.Clear(); 1380 m_landList.Clear();
1381 }
1336 1382
1337 for (int i = 0; i < data.Count; i++) 1383 for (int i = 0; i < data.Count; i++)
1338 { 1384 {
1339 IncomingLandObjectFromStorage(data[i]); 1385 IncomingLandObjectFromStorage(data[i]);
1340 }
1341 } 1386 }
1342 } 1387 }
1343 1388
@@ -1366,7 +1411,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1366 1411
1367 public void EventManagerOnNoLandDataFromStorage() 1412 public void EventManagerOnNoLandDataFromStorage()
1368 { 1413 {
1369 lock (m_landList) 1414 // called methods already have locks
1415// lock (m_landList)
1370 { 1416 {
1371 ResetSimLandObjects(); 1417 ResetSimLandObjects();
1372 CreateDefaultParcel(); 1418 CreateDefaultParcel();
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
36namespace OpenSim.Region.Framework.Interfaces 36namespace 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/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index e4e6f2c..233e559 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -272,8 +272,6 @@ namespace OpenSim.Region.Framework.Scenes
272 newmotion.m_basePosition = m_basePosition; 272 newmotion.m_basePosition = m_basePosition;
273 newmotion.m_baseRotation = m_baseRotation; 273 newmotion.m_baseRotation = m_baseRotation;
274 274
275 newmotion.m_currentFrame = m_currentFrame;
276
277 if (m_selected) 275 if (m_selected)
278 newmotion.m_serializedPosition = m_serializedPosition; 276 newmotion.m_serializedPosition = m_serializedPosition;
279 else 277 else
@@ -284,6 +282,8 @@ namespace OpenSim.Region.Framework.Scenes
284 newmotion.m_serializedPosition = m_serializedPosition; 282 newmotion.m_serializedPosition = m_serializedPosition;
285 } 283 }
286 284
285 newmotion.m_currentFrame = m_currentFrame;
286
287 newmotion.m_iterations = m_iterations; 287 newmotion.m_iterations = m_iterations;
288 newmotion.m_running = m_running; 288 newmotion.m_running = m_running;
289 289
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3af1060..66cce60 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2931,9 +2931,11 @@ namespace OpenSim.Region.Framework.Scenes
2931 { 2931 {
2932 EventManager.TriggerOnClientLogin(client); 2932 EventManager.TriggerOnClientLogin(client);
2933 // Send initial parcel data 2933 // Send initial parcel data
2934/* this is done on TriggerOnNewClient by landmanegement respective event handler
2934 Vector3 pos = sp.AbsolutePosition; 2935 Vector3 pos = sp.AbsolutePosition;
2935 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); 2936 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y);
2936 land.SendLandUpdateToClient(client); 2937 land.SendLandUpdateToClient(client);
2938*/
2937 } 2939 }
2938 2940
2939 return sp; 2941 return sp;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 38dbaa9..18e74c1 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);
@@ -2159,6 +2159,7 @@ namespace OpenSim.Region.Framework.Scenes
2159 2159
2160 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 2160 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
2161 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 2161 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
2162
2162 2163
2163 if (userExposed) 2164 if (userExposed)
2164 dupe.m_rootPart.TrimPermissions(); 2165 dupe.m_rootPart.TrimPermissions();
@@ -2209,6 +2210,9 @@ namespace OpenSim.Region.Framework.Scenes
2209 if (userExposed) 2210 if (userExposed)
2210 newPart.ApplyPhysics((uint)newPart.Flags,newPart.VolumeDetectActive,true); 2211 newPart.ApplyPhysics((uint)newPart.Flags,newPart.VolumeDetectActive,true);
2211// } 2212// }
2213 // copy keyframemotion
2214 if (part.KeyframeMotion != null)
2215 newPart.KeyframeMotion = part.KeyframeMotion.Copy(dupe);
2212 } 2216 }
2213 2217
2214 if (userExposed) 2218 if (userExposed)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8e419f9..4af508e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2110,8 +2110,8 @@ namespace OpenSim.Region.Framework.Scenes
2110 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 2110 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
2111 dupe.Shape.ExtraParams = extraP; 2111 dupe.Shape.ExtraParams = extraP;
2112 2112
2113 if (KeyframeMotion != null) 2113 // safeguard actual copy is done in sog.copy
2114 dupe.KeyframeMotion = KeyframeMotion.Copy(null); 2114 dupe.KeyframeMotion = null;
2115 2115
2116 if (userExposed) 2116 if (userExposed)
2117 { 2117 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0176921..adb3d38 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1266,7 +1266,8 @@ namespace OpenSim.Region.Framework.Scenes
1266 1266
1267 Vector3 look = Velocity; 1267 Vector3 look = Velocity;
1268 1268
1269 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1269 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
1270 if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1))
1270 { 1271 {
1271 look = new Vector3(0.99f, 0.042f, 0); 1272 look = new Vector3(0.99f, 0.042f, 0);
1272 } 1273 }
@@ -1316,13 +1317,15 @@ namespace OpenSim.Region.Framework.Scenes
1316 // Create child agents in neighbouring regions 1317 // Create child agents in neighbouring regions
1317 if (openChildAgents && !IsChildAgent) 1318 if (openChildAgents && !IsChildAgent)
1318 { 1319 {
1320
1319 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1321 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1320 if (m_agentTransfer != null) 1322 if (m_agentTransfer != null)
1321 Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); }); 1323 m_agentTransfer.EnableChildAgents(this);
1322 1324
1323 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1325 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1324 if (friendsModule != null) 1326 if (friendsModule != null)
1325 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1327 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1328
1326 } 1329 }
1327 1330
1328// m_log.DebugFormat( 1331// m_log.DebugFormat(
@@ -3438,7 +3441,7 @@ namespace OpenSim.Region.Framework.Scenes
3438 /// <param name="e"></param> 3441 /// <param name="e"></param>
3439 public void PhysicsCollisionUpdate(EventArgs e) 3442 public void PhysicsCollisionUpdate(EventArgs e)
3440 { 3443 {
3441 if (IsChildAgent) 3444 if (IsChildAgent || Animator == null)
3442 return; 3445 return;
3443 3446
3444 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 3447 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
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 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1969492..9570669 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3386,7 +3386,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3386 public void llInstantMessage(string user, string message) 3386 public void llInstantMessage(string user, string message)
3387 { 3387 {
3388 UUID result; 3388 UUID result;
3389 if (!UUID.TryParse(user, out result)) 3389 if (!UUID.TryParse(user, out result) || result == UUID.Zero)
3390 { 3390 {
3391 ShoutError("An invalid key was passed to llInstantMessage"); 3391 ShoutError("An invalid key was passed to llInstantMessage");
3392 ScriptSleep(2000); 3392 ScriptSleep(2000);
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 45ebf3a..9e04601 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -126,7 +126,10 @@ namespace OpenSim.Services.Connectors
126 126
127 // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix); 127 // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix);
128 128
129 return serverUri.Uri.AbsoluteUri; 129 string ret = serverUri.Uri.AbsoluteUri;
130 if (ret.EndsWith("/"))
131 ret = ret.Substring(0, ret.Length - 1);
132 return ret;
130 } 133 }
131 134
132 protected void retryCheck(object source, ElapsedEventArgs e) 135 protected void retryCheck(object source, ElapsedEventArgs e)
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
index 3fd0c53..6cd21d1 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
@@ -144,44 +144,48 @@ namespace OpenSim.Services.Connectors.Friends
144 144
145 private bool Call(GridRegion region, Dictionary<string, object> sendData) 145 private bool Call(GridRegion region, Dictionary<string, object> sendData)
146 { 146 {
147 string reqString = ServerUtils.BuildQueryString(sendData); 147 Util.FireAndForget(x => {
148 //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); 148 string reqString = ServerUtils.BuildQueryString(sendData);
149 if (region == null) 149 //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString);
150 return false; 150 if (region == null)
151 151 return;
152 string path = ServicePath(); 152
153 if (!region.ServerURI.EndsWith("/")) 153 string path = ServicePath();
154 path = "/" + path; 154 if (!region.ServerURI.EndsWith("/"))
155 string uri = region.ServerURI + path; 155 path = "/" + path;
156 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); 156 string uri = region.ServerURI + path;
157 157 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri);
158 try 158
159 { 159 try
160 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
161 if (reply != string.Empty)
162 { 160 {
163 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 161 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
164 162 if (reply != string.Empty)
165 if (replyData.ContainsKey("RESULT"))
166 { 163 {
167 if (replyData["RESULT"].ToString().ToLower() == "true") 164 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
168 return true; 165
166 if (replyData.ContainsKey("RESULT"))
167 {
168// if (replyData["RESULT"].ToString().ToLower() == "true")
169// return;
170// else
171 return;
172 }
169 else 173 else
170 return false; 174 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field");
175
171 } 176 }
172 else 177 else
173 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); 178 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply");
174 179 }
180 catch (Exception e)
181 {
182 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message);
175 } 183 }
176 else 184
177 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); 185 return;
178 } 186 });
179 catch (Exception e) 187
180 { 188 return true;
181 m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message);
182 }
183
184 return false;
185 } 189 }
186 } 190 }
187} 191}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index e1c2243..508baf7 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -395,17 +395,18 @@ namespace OpenSim.Services.Connectors.Simulation
395 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 395 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
396 { 396 {
397// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); 397// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
398 Util.FireAndForget(x => {
399 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
398 400
399 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 401 try
400 402 {
401 try 403 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
402 { 404 }
403 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); 405 catch (Exception e)
404 } 406 {
405 catch (Exception e) 407 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString());
406 { 408 }
407 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); 409 });
408 }
409 410
410 return true; 411 return true;
411 } 412 }