aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDan Lake2011-04-29 15:49:49 -0700
committerDan Lake2011-04-29 15:49:49 -0700
commit8f14c3f04f6f4ddeafdfc83c1719ec5cddfe7dfe (patch)
treebe718fbb3ab2e404b5cb650d544eec86abb0bb42 /OpenSim
parentFix crash when [Mesh] section is missing from configuration files (diff)
parentMinor correction to yesterday's changes. Make normal prim crossing (no attach... (diff)
downloadopensim-SC_OLD-8f14c3f04f6f4ddeafdfc83c1719ec5cddfe7dfe.zip
opensim-SC_OLD-8f14c3f04f6f4ddeafdfc83c1719ec5cddfe7dfe.tar.gz
opensim-SC_OLD-8f14c3f04f6f4ddeafdfc83c1719ec5cddfe7dfe.tar.bz2
opensim-SC_OLD-8f14c3f04f6f4ddeafdfc83c1719ec5cddfe7dfe.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs1728
-rw-r--r--OpenSim/Client/MXP/MXPModule.cs131
-rw-r--r--OpenSim/Client/MXP/MXPUtil.cs42
-rw-r--r--OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs561
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs1231
-rw-r--r--OpenSim/Client/VWoHTTP/VWoHTTPModule.cs133
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs6
-rw-r--r--OpenSim/Data/MSSQL/MSSQLMigration.cs3
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs25
-rw-r--r--OpenSim/Data/MSSQL/Resources/AuthStore.migrations8
-rw-r--r--OpenSim/Data/MSSQL/Resources/Avatar.migrations25
-rw-r--r--OpenSim/Data/MSSQL/Resources/FriendsStore.migrations4
-rw-r--r--OpenSim/Data/MSSQL/Resources/GridStore.migrations13
-rw-r--r--OpenSim/Data/MSSQL/Resources/InventoryStore.migrations9
-rw-r--r--OpenSim/Data/MSSQL/Resources/Presence.migrations17
-rw-r--r--OpenSim/Data/MSSQL/Resources/RegionStore.migrations119
-rw-r--r--OpenSim/Data/MSSQL/Resources/UserAccount.migrations2
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs69
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs57
-rw-r--r--OpenSim/Framework/ClientInfo.cs3
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs4
-rw-r--r--OpenSim/Framework/IClientAPI.cs59
-rw-r--r--OpenSim/Framework/PriorityQueue.cs (renamed from OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs)132
-rw-r--r--OpenSim/Framework/RegionInfo.cs17
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs2
-rw-r--r--OpenSim/Framework/Util.cs17
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs206
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs82
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs68
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs80
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs142
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs66
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs61
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs34
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs48
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs194
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs121
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs9
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs10
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs19
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs39
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs2
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs40
59 files changed, 1311 insertions, 4442 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
deleted file mode 100644
index a604a2e..0000000
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ /dev/null
@@ -1,1728 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using System.Text;
33using log4net;
34using MXP;
35using MXP.Messages;
36using OpenMetaverse;
37using OpenMetaverse.Packets;
38using OpenSim.Framework;
39using OpenSim.Framework.Client;
40using Packet=OpenMetaverse.Packets.Packet;
41using MXP.Extentions.OpenMetaverseFragments.Proto;
42using MXP.Util;
43using MXP.Fragments;
44using MXP.Common.Proto;
45using OpenSim.Region.Framework.Scenes;
46
47namespace OpenSim.Client.MXP.ClientStack
48{
49 public class MXPClientView : IClientAPI, IClientCore
50 {
51 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 #region Constants
54 private Vector3 FORWARD = new Vector3(1, 0, 0);
55 private Vector3 BACKWARD = new Vector3(-1, 0, 0);
56 private Vector3 LEFT = new Vector3(0, 1, 0);
57 private Vector3 RIGHT = new Vector3(0, -1, 0);
58 private Vector3 UP = new Vector3(0, 0, 1);
59 private Vector3 DOWN = new Vector3(0, 0, -1);
60 #endregion
61
62 #region Fields
63 private readonly Session m_session;
64 private readonly UUID m_sessionID;
65 private readonly UUID m_userID;
66 private readonly IScene m_scene;
67 private readonly string m_firstName;
68 private readonly string m_lastName;
69// private int m_objectsToSynchronize = 0;
70// private int m_objectsSynchronized = -1;
71
72 private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
73 #endregion
74
75 #region Properties
76
77 public Session Session
78 {
79 get { return m_session; }
80 }
81
82 public Vector3 StartPos
83 {
84 get { return m_startPosition; }
85 set { m_startPosition = value; }
86 }
87
88 public UUID AgentId
89 {
90 get { return m_userID; }
91 }
92
93 public UUID SessionId
94 {
95 get { return m_sessionID; }
96 }
97
98 public UUID SecureSessionId
99 {
100 get { return m_sessionID; }
101 }
102
103 public UUID ActiveGroupId
104 {
105 get { return UUID.Zero; }
106 }
107
108 public string ActiveGroupName
109 {
110 get { return ""; }
111 }
112
113 public ulong ActiveGroupPowers
114 {
115 get { return 0; }
116 }
117
118 public ulong GetGroupPowers(UUID groupID)
119 {
120 return 0;
121 }
122
123 public bool IsGroupMember(UUID GroupID)
124 {
125 return false;
126 }
127
128 public string FirstName
129 {
130 get { return m_firstName; }
131 }
132
133 public string LastName
134 {
135 get { return m_lastName; }
136 }
137
138 public IScene Scene
139 {
140 get { return m_scene; }
141 }
142
143 public int NextAnimationSequenceNumber
144 {
145 get { return 0; }
146 }
147
148 public string Name
149 {
150 get { return FirstName; }
151 }
152
153 public bool IsActive
154 {
155 get { return Session.SessionState == SessionState.Connected; }
156 set
157 {
158 if (!value)
159 Stop();
160 }
161 }
162
163 public bool IsLoggingOut
164 {
165 get { return false ; }
166 set { }
167 }
168
169 #endregion
170
171 #region Constructors
172 public MXPClientView(Session mxpSession, UUID mxpSessionID, UUID userID, IScene mxpHostBubble, string mxpFirstName, string mxpLastName)
173 {
174 this.m_session = mxpSession;
175 this.m_userID = userID;
176 this.m_firstName = mxpFirstName;
177 this.m_lastName = mxpLastName;
178 this.m_scene = mxpHostBubble;
179 this.m_sessionID = mxpSessionID;
180 }
181 #endregion
182
183 #region MXP Incoming Message Processing
184
185 public void MXPPRocessMessage(Message message)
186 {
187 if (message.GetType() == typeof(ModifyRequestMessage))
188 {
189 MXPProcessModifyRequest((ModifyRequestMessage)message);
190 }
191 else
192 {
193 m_log.Warn("[MXP ClientStack] Received messaged unhandled: " + message);
194 }
195 }
196
197 private void MXPProcessModifyRequest(ModifyRequestMessage modifyRequest)
198 {
199 ObjectFragment objectFragment=modifyRequest.ObjectFragment;
200 if (objectFragment.ObjectId == m_userID.Guid)
201 {
202 OmAvatarExt avatarExt = modifyRequest.GetExtension<OmAvatarExt>();
203
204 AgentUpdateArgs agentUpdate = new AgentUpdateArgs();
205 agentUpdate.AgentID = new UUID(objectFragment.ObjectId);
206 agentUpdate.SessionID = m_sessionID;
207 agentUpdate.State = (byte)avatarExt.State;
208
209 Quaternion avatarOrientation = FromOmQuaternion(objectFragment.Orientation);
210 if (avatarOrientation.X == 0 && avatarOrientation.Y == 0 && avatarOrientation.Z == 0 && avatarOrientation.W == 0)
211 {
212 avatarOrientation = Quaternion.Identity;
213 }
214 Vector3 avatarLocation=FromOmVector(objectFragment.Location);
215
216 if (avatarExt.MovementDirection != null)
217 {
218 Vector3 direction = FromOmVector(avatarExt.MovementDirection);
219
220 direction = direction * Quaternion.Inverse(avatarOrientation);
221
222 if ((direction - FORWARD).Length() < 0.5)
223 {
224 agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
225 }
226 if ((direction - BACKWARD).Length() < 0.5)
227 {
228 agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG;
229 }
230 if ((direction - LEFT).Length() < 0.5)
231 {
232 agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS;
233 }
234 if ((direction - RIGHT).Length() < 0.5)
235 {
236 agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG;
237 }
238 if ((direction - UP).Length() < 0.5)
239 {
240 agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
241 }
242 if ((direction - DOWN).Length() < 0.5)
243 {
244 agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG;
245 }
246
247 }
248 if (avatarExt.TargetOrientation != null)
249 {
250 agentUpdate.BodyRotation = FromOmQuaternion(avatarExt.TargetOrientation);
251 }
252 else
253 {
254 agentUpdate.BodyRotation = FromOmQuaternion(objectFragment.Orientation);
255 }
256
257 if (avatarExt.Body != null)
258 {
259 foreach (OmBipedBoneOrientation boneOrientation in avatarExt.Body.BipedBoneOrientations)
260 {
261 if (boneOrientation.Bone == OmBipedBones.Head)
262 {
263 agentUpdate.HeadRotation = FromOmQuaternion(boneOrientation.Orientation);
264 }
265 }
266 }
267 else
268 {
269 agentUpdate.HeadRotation = Quaternion.Identity;
270 }
271
272 if (avatarExt.Camera != null)
273 {
274 Quaternion cameraOrientation = FromOmQuaternion(avatarExt.Camera.Orientation);
275 agentUpdate.CameraCenter = FromOmVector(avatarExt.Camera.Location);
276 agentUpdate.CameraAtAxis = FORWARD * cameraOrientation;
277 agentUpdate.CameraLeftAxis = LEFT * cameraOrientation;
278 agentUpdate.CameraUpAxis = UP * cameraOrientation;
279 }
280 else
281 {
282 agentUpdate.CameraCenter = avatarLocation;
283 agentUpdate.CameraAtAxis = FORWARD * avatarOrientation;
284 agentUpdate.CameraLeftAxis = LEFT * avatarOrientation;
285 agentUpdate.CameraUpAxis = UP * avatarOrientation;
286 }
287
288 OnAgentUpdate(this, agentUpdate);
289
290 ModifyResponseMessage modifyResponse = new ModifyResponseMessage();
291 modifyResponse.FailureCode = MxpResponseCodes.SUCCESS;
292 modifyResponse.RequestMessageId = modifyRequest.MessageId;
293 m_session.Send(modifyResponse);
294 }
295 else
296 {
297 ModifyResponseMessage modifyResponse = new ModifyResponseMessage();
298 modifyResponse.FailureCode = MxpResponseCodes.UNAUTHORIZED_OPERATION;
299 modifyResponse.RequestMessageId = modifyRequest.MessageId;
300 m_session.Send(modifyResponse);
301 }
302 }
303
304 #endregion
305
306 #region MXP Outgoing Message Processing
307
308// private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
309// {
310// String typeName = ToOmType(primShape.PCode);
311// m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
312//
313// PerceptionEventMessage pe = new PerceptionEventMessage();
314// pe.ObjectFragment.ObjectId = objectID.Guid;
315//
316// pe.ObjectFragment.ParentObjectId = Guid.Empty;
317//
318// // Resolving parent UUID.
319// OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene;
320// if (scene.Entities.ContainsKey(parentID))
321// {
322// pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid;
323// }
324//
325// pe.ObjectFragment.ObjectIndex = localID;
326// pe.ObjectFragment.ObjectName = typeName + " Object";
327// pe.ObjectFragment.OwnerId = ownerID.Guid;
328// pe.ObjectFragment.TypeId = Guid.Empty;
329// pe.ObjectFragment.TypeName = typeName;
330// pe.ObjectFragment.Acceleration = ToOmVector(acc);
331// pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f();
332// pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel);
333// pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
334//
335// pe.ObjectFragment.Location = ToOmVector(pos);
336//
337// pe.ObjectFragment.Mass = 1.0f;
338// pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
339// pe.ObjectFragment.Velocity =ToOmVector(vel);
340//
341// OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
342//
343// if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
344// {
345//
346// ext.PathBegin = primShape.PathBegin;
347// ext.PathEnd = primShape.PathEnd;
348// ext.PathScaleX = primShape.PathScaleX;
349// ext.PathScaleY = primShape.PathScaleY;
350// ext.PathShearX = primShape.PathShearX;
351// ext.PathShearY = primShape.PathShearY;
352// ext.PathSkew = primShape.PathSkew;
353// ext.ProfileBegin = primShape.ProfileBegin;
354// ext.ProfileEnd = primShape.ProfileEnd;
355// ext.PathCurve = primShape.PathCurve;
356// ext.ProfileCurve = primShape.ProfileCurve;
357// ext.ProfileHollow = primShape.ProfileHollow;
358// ext.PathRadiusOffset = primShape.PathRadiusOffset;
359// ext.PathRevolutions = primShape.PathRevolutions;
360// ext.PathTaperX = primShape.PathTaperX;
361// ext.PathTaperY = primShape.PathTaperY;
362// ext.PathTwist = primShape.PathTwist;
363// ext.PathTwistBegin = primShape.PathTwistBegin;
364//
365//
366// }
367//
368// ext.UpdateFlags = flags;
369// ext.ExtraParams = primShape.ExtraParams;
370// ext.State = primShape.State;
371// ext.TextureEntry = primShape.TextureEntry;
372// ext.TextureAnim = textureanim;
373// ext.Scale = ToOmVector(primShape.Scale);
374// ext.Text = text;
375// ext.TextColor = ToOmColor(textColor);
376// ext.PSBlock = particleSystem;
377// ext.ClickAction = clickAction;
378// ext.Material = material;
379//
380// pe.SetExtension<OmSlPrimitiveExt>(ext);
381//
382// Session.Send(pe);
383//
384// if (m_objectsSynchronized != -1)
385// {
386// m_objectsSynchronized++;
387//
388// if (m_objectsToSynchronize >= m_objectsSynchronized)
389// {
390// SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage();
391// Session.Send(synchronizationEndEventMessage);
392// m_objectsSynchronized = -1;
393// }
394// }
395// }
396
397 public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation)
398 {
399 m_log.Info("[MXP ClientStack] Transmitting Avatar Data " + participantName);
400
401 PerceptionEventMessage pe = new PerceptionEventMessage();
402
403 pe.ObjectFragment.ObjectId = avatarID.Guid;
404 pe.ObjectFragment.ParentObjectId = parentId.Guid;
405 pe.ObjectFragment.ObjectIndex = avatarLocalID;
406 pe.ObjectFragment.ObjectName = participantName;
407 pe.ObjectFragment.OwnerId = ownerID.Guid;
408 pe.ObjectFragment.TypeId = Guid.Empty;
409 pe.ObjectFragment.TypeName = "Avatar";
410 pe.ObjectFragment.Acceleration = new MsdVector3f();
411 pe.ObjectFragment.AngularAcceleration = new MsdQuaternion4f();
412 pe.ObjectFragment.AngularVelocity = new MsdQuaternion4f();
413
414 pe.ObjectFragment.BoundingSphereRadius = 1.0f; // TODO Fill in appropriate value
415
416 pe.ObjectFragment.Location = ToOmVector(position);
417
418 pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value
419 pe.ObjectFragment.Orientation = ToOmQuaternion(rotation);
420 pe.ObjectFragment.Velocity = new MsdVector3f();
421
422 Session.Send(pe);
423 }
424
425 public void MXPSendTerrain(float[] map)
426 {
427 m_log.Info("[MXP ClientStack] Transmitting terrain for " + m_scene.RegionInfo.RegionName);
428
429 PerceptionEventMessage pe = new PerceptionEventMessage();
430
431 // Hacking terrain object uuid to zero and index to hashcode of regionuuid
432 pe.ObjectFragment.ObjectId = m_scene.RegionInfo.RegionSettings.RegionUUID.Guid;
433 pe.ObjectFragment.ObjectIndex = (uint)(m_scene.RegionInfo.RegionSettings.RegionUUID.GetHashCode() + ((long)int.MaxValue) / 2);
434 pe.ObjectFragment.ParentObjectId = UUID.Zero.Guid;
435 pe.ObjectFragment.ObjectName = "Terrain of " + m_scene.RegionInfo.RegionName;
436 pe.ObjectFragment.OwnerId = m_scene.RegionInfo.EstateSettings.EstateOwner.Guid;
437 pe.ObjectFragment.TypeId = Guid.Empty;
438 pe.ObjectFragment.TypeName = "Terrain";
439 pe.ObjectFragment.Acceleration = new MsdVector3f();
440 pe.ObjectFragment.AngularAcceleration = new MsdQuaternion4f();
441 pe.ObjectFragment.AngularVelocity = new MsdQuaternion4f();
442 pe.ObjectFragment.BoundingSphereRadius = 128f;
443
444 pe.ObjectFragment.Location = new MsdVector3f();
445
446 pe.ObjectFragment.Mass = 1.0f;
447 pe.ObjectFragment.Orientation = new MsdQuaternion4f();
448 pe.ObjectFragment.Velocity = new MsdVector3f();
449
450 OmBitmapTerrainExt terrainExt = new OmBitmapTerrainExt();
451 terrainExt.Width = 256;
452 terrainExt.Height = 256;
453 terrainExt.WaterLevel = (float) m_scene.RegionInfo.RegionSettings.WaterHeight;
454 terrainExt.Offset = 0;
455 terrainExt.Scale = 10;
456 terrainExt.HeightMap = CompressUtil.CompressHeightMap(map, 0, 10);
457
458 pe.SetExtension<OmBitmapTerrainExt>(terrainExt);
459
460 Session.Send(pe);
461 }
462
463 public void MXPSendSynchronizationBegin(int objectCount)
464 {
465// m_objectsToSynchronize = objectCount;
466// m_objectsSynchronized = 0;
467 SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage();
468 synchronizationBeginEventMessage.ObjectCount = (uint)objectCount;
469 Session.Send(synchronizationBeginEventMessage);
470 }
471
472 #endregion
473
474 #region MXP Conversions
475
476 private MsdVector3f ToOmVector(Vector3 value)
477 {
478 MsdVector3f encodedValue = new MsdVector3f();
479 encodedValue.X = value.X;
480 encodedValue.Y = value.Y;
481 encodedValue.Z = value.Z;
482 return encodedValue;
483 }
484
485 private MsdQuaternion4f ToOmQuaternion(Vector3 value)
486 {
487 Quaternion quaternion=Quaternion.CreateFromEulers(value);
488 MsdQuaternion4f encodedValue = new MsdQuaternion4f();
489 encodedValue.X = quaternion.X;
490 encodedValue.Y = quaternion.Y;
491 encodedValue.Z = quaternion.Z;
492 encodedValue.W = quaternion.W;
493 return encodedValue;
494 }
495
496 private MsdQuaternion4f ToOmQuaternion(Quaternion value)
497 {
498 MsdQuaternion4f encodedValue = new MsdQuaternion4f();
499 encodedValue.X = value.X;
500 encodedValue.Y = value.Y;
501 encodedValue.Z = value.Z;
502 encodedValue.W = value.W;
503 return encodedValue;
504 }
505
506 private Vector3 FromOmVector(MsdVector3f vector)
507 {
508 return new Vector3(vector.X, vector.Y, vector.Z);
509 }
510
511// private Vector3 FromOmVector(float[] vector)
512// {
513// return new Vector3(vector[0], vector[1], vector[2]);
514// }
515
516 private Quaternion FromOmQuaternion(MsdQuaternion4f quaternion)
517 {
518 return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W);
519 }
520
521// private Quaternion FromOmQuaternion(float[] quaternion)
522// {
523// return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]);
524// }
525
526 private MsdColor4f ToOmColor(byte[] value)
527 {
528 MsdColor4f encodedValue = new MsdColor4f();
529 encodedValue.R = value[0];
530 encodedValue.G = value[1];
531 encodedValue.B = value[2];
532 encodedValue.A = value[3];
533 return encodedValue;
534 }
535
536 private string ToOmType(byte value)
537 {
538 if (value == (byte)PCodeEnum.Avatar)
539 {
540 return "Avatar";
541 }
542 if (value == (byte)PCodeEnum.Grass)
543 {
544 return "Grass";
545 }
546 if (value == (byte)PCodeEnum.NewTree)
547 {
548 return "NewTree";
549 }
550 if (value == (byte)PCodeEnum.ParticleSystem)
551 {
552 return "ParticleSystem";
553 }
554 if (value == (byte)PCodeEnum.Primitive)
555 {
556 return "Primitive";
557 }
558 if (value == (byte)PCodeEnum.Tree)
559 {
560 return "Tree";
561 }
562 throw new Exception("Unsupported PCode value: " + value);
563 }
564
565 #endregion
566
567 #region OpenSim Event Handlers
568
569 #pragma warning disable 67
570 public event GenericMessage OnGenericMessage;
571 public event ImprovedInstantMessage OnInstantMessage;
572 public event ChatMessage OnChatFromClient;
573 public event TextureRequest OnRequestTexture;
574 public event RezObject OnRezObject;
575 public event ModifyTerrain OnModifyTerrain;
576 public event BakeTerrain OnBakeTerrain;
577 public event EstateChangeInfo OnEstateChangeInfo;
578 public event SetAppearance OnSetAppearance;
579 public event AvatarNowWearing OnAvatarNowWearing;
580 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
581 public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
582 public event UUIDNameRequest OnDetachAttachmentIntoInv;
583 public event ObjectAttach OnObjectAttach;
584 public event ObjectDeselect OnObjectDetach;
585 public event ObjectDrop OnObjectDrop;
586 public event StartAnim OnStartAnim;
587 public event StopAnim OnStopAnim;
588 public event LinkObjects OnLinkObjects;
589 public event DelinkObjects OnDelinkObjects;
590 public event RequestMapBlocks OnRequestMapBlocks;
591 public event RequestMapName OnMapNameRequest;
592 public event TeleportLocationRequest OnTeleportLocationRequest;
593 public event DisconnectUser OnDisconnectUser;
594 public event RequestAvatarProperties OnRequestAvatarProperties;
595 public event SetAlwaysRun OnSetAlwaysRun;
596 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
597 public event DeRezObject OnDeRezObject;
598 public event Action<IClientAPI> OnRegionHandShakeReply;
599 public event GenericCall1 OnRequestWearables;
600 public event GenericCall1 OnCompleteMovementToRegion;
601 public event UpdateAgent OnPreAgentUpdate;
602 public event UpdateAgent OnAgentUpdate;
603 public event AgentRequestSit OnAgentRequestSit;
604 public event AgentSit OnAgentSit;
605 public event AvatarPickerRequest OnAvatarPickerRequest;
606 public event Action<IClientAPI> OnRequestAvatarsData;
607 public event AddNewPrim OnAddPrim;
608 public event FetchInventory OnAgentDataUpdateRequest;
609 public event TeleportLocationRequest OnSetStartLocationRequest;
610 public event RequestGodlikePowers OnRequestGodlikePowers;
611 public event GodKickUser OnGodKickUser;
612 public event ObjectDuplicate OnObjectDuplicate;
613 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
614 public event GrabObject OnGrabObject;
615 public event DeGrabObject OnDeGrabObject;
616 public event MoveObject OnGrabUpdate;
617 public event SpinStart OnSpinStart;
618 public event SpinObject OnSpinUpdate;
619 public event SpinStop OnSpinStop;
620 public event UpdateShape OnUpdatePrimShape;
621 public event ObjectExtraParams OnUpdateExtraParams;
622 public event ObjectRequest OnObjectRequest;
623 public event ObjectSelect OnObjectSelect;
624 public event ObjectDeselect OnObjectDeselect;
625 public event GenericCall7 OnObjectDescription;
626 public event GenericCall7 OnObjectName;
627 public event GenericCall7 OnObjectClickAction;
628 public event GenericCall7 OnObjectMaterial;
629 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
630 public event UpdatePrimFlags OnUpdatePrimFlags;
631 public event UpdatePrimTexture OnUpdatePrimTexture;
632 public event UpdateVector OnUpdatePrimGroupPosition;
633 public event UpdateVector OnUpdatePrimSinglePosition;
634 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
635 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
636 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
637 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
638 public event UpdateVector OnUpdatePrimScale;
639 public event UpdateVector OnUpdatePrimGroupScale;
640 public event StatusChange OnChildAgentStatus;
641 public event GenericCall2 OnStopMovement;
642 public event Action<UUID> OnRemoveAvatar;
643 public event ObjectPermissions OnObjectPermissions;
644 public event CreateNewInventoryItem OnCreateNewInventoryItem;
645 public event LinkInventoryItem OnLinkInventoryItem;
646 public event CreateInventoryFolder OnCreateNewInventoryFolder;
647 public event UpdateInventoryFolder OnUpdateInventoryFolder;
648 public event MoveInventoryFolder OnMoveInventoryFolder;
649 public event FetchInventoryDescendents OnFetchInventoryDescendents;
650 public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
651 public event FetchInventory OnFetchInventory;
652 public event RequestTaskInventory OnRequestTaskInventory;
653 public event UpdateInventoryItem OnUpdateInventoryItem;
654 public event CopyInventoryItem OnCopyInventoryItem;
655 public event MoveInventoryItem OnMoveInventoryItem;
656 public event RemoveInventoryFolder OnRemoveInventoryFolder;
657 public event RemoveInventoryItem OnRemoveInventoryItem;
658 public event UDPAssetUploadRequest OnAssetUploadRequest;
659 public event XferReceive OnXferReceive;
660 public event RequestXfer OnRequestXfer;
661 public event ConfirmXfer OnConfirmXfer;
662 public event AbortXfer OnAbortXfer;
663 public event RezScript OnRezScript;
664 public event UpdateTaskInventory OnUpdateTaskInventory;
665 public event MoveTaskInventory OnMoveTaskItem;
666 public event RemoveTaskInventory OnRemoveTaskItem;
667 public event RequestAsset OnRequestAsset;
668 public event UUIDNameRequest OnNameFromUUIDRequest;
669 public event ParcelAccessListRequest OnParcelAccessListRequest;
670 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
671 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
672 public event ParcelDivideRequest OnParcelDivideRequest;
673 public event ParcelJoinRequest OnParcelJoinRequest;
674 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
675 public event ParcelSelectObjects OnParcelSelectObjects;
676 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
677 public event ParcelAbandonRequest OnParcelAbandonRequest;
678 public event ParcelGodForceOwner OnParcelGodForceOwner;
679 public event ParcelReclaim OnParcelReclaim;
680 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
681 public event ParcelDeedToGroup OnParcelDeedToGroup;
682 public event RegionInfoRequest OnRegionInfoRequest;
683 public event EstateCovenantRequest OnEstateCovenantRequest;
684 public event FriendActionDelegate OnApproveFriendRequest;
685 public event FriendActionDelegate OnDenyFriendRequest;
686 public event FriendshipTermination OnTerminateFriendship;
687 public event GrantUserFriendRights OnGrantUserRights;
688 public event MoneyTransferRequest OnMoneyTransferRequest;
689 public event EconomyDataRequest OnEconomyDataRequest;
690 public event MoneyBalanceRequest OnMoneyBalanceRequest;
691 public event UpdateAvatarProperties OnUpdateAvatarProperties;
692 public event ParcelBuy OnParcelBuy;
693 public event RequestPayPrice OnRequestPayPrice;
694 public event ObjectSaleInfo OnObjectSaleInfo;
695 public event ObjectBuy OnObjectBuy;
696 public event BuyObjectInventory OnBuyObjectInventory;
697 public event RequestTerrain OnRequestTerrain;
698 public event RequestTerrain OnUploadTerrain;
699 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
700 public event UUIDNameRequest OnTeleportHomeRequest;
701 public event ScriptAnswer OnScriptAnswer;
702 public event AgentSit OnUndo;
703 public event AgentSit OnRedo;
704 public event LandUndo OnLandUndo;
705 public event ForceReleaseControls OnForceReleaseControls;
706 public event GodLandStatRequest OnLandStatRequest;
707 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
708 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
709 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
710 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
711 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
712 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
713 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
714 public event EstateRestartSimRequest OnEstateRestartSimRequest;
715 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
716 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
717 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
718 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
719 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
720 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
721 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
722 public event UUIDNameRequest OnUUIDGroupNameRequest;
723 public event RegionHandleRequest OnRegionHandleRequest;
724 public event ParcelInfoRequest OnParcelInfoRequest;
725 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
726 public event ScriptReset OnScriptReset;
727 public event GetScriptRunning OnGetScriptRunning;
728 public event SetScriptRunning OnSetScriptRunning;
729 public event UpdateVector OnAutoPilotGo;
730 public event TerrainUnacked OnUnackedTerrain;
731 public event ActivateGesture OnActivateGesture;
732 public event DeactivateGesture OnDeactivateGesture;
733 public event ObjectOwner OnObjectOwner;
734 public event DirPlacesQuery OnDirPlacesQuery;
735 public event DirFindQuery OnDirFindQuery;
736 public event DirLandQuery OnDirLandQuery;
737 public event DirPopularQuery OnDirPopularQuery;
738 public event DirClassifiedQuery OnDirClassifiedQuery;
739 public event EventInfoRequest OnEventInfoRequest;
740 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
741 public event MapItemRequest OnMapItemRequest;
742 public event OfferCallingCard OnOfferCallingCard;
743 public event AcceptCallingCard OnAcceptCallingCard;
744 public event DeclineCallingCard OnDeclineCallingCard;
745 public event SoundTrigger OnSoundTrigger;
746 public event StartLure OnStartLure;
747 public event TeleportLureRequest OnTeleportLureRequest;
748 public event NetworkStats OnNetworkStatsUpdate;
749 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
750 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
751 public event ClassifiedDelete OnClassifiedDelete;
752 public event ClassifiedDelete OnClassifiedGodDelete;
753 public event EventNotificationAddRequest OnEventNotificationAddRequest;
754 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
755 public event EventGodDelete OnEventGodDelete;
756 public event ParcelDwellRequest OnParcelDwellRequest;
757 public event UserInfoRequest OnUserInfoRequest;
758 public event UpdateUserInfo OnUpdateUserInfo;
759 public event ViewerEffectEventHandler OnViewerEffect;
760 public event Action<IClientAPI> OnLogout;
761 public event Action<IClientAPI> OnConnectionClosed;
762 public event RetrieveInstantMessages OnRetrieveInstantMessages;
763 public event PickDelete OnPickDelete;
764 public event PickGodDelete OnPickGodDelete;
765 public event PickInfoUpdate OnPickInfoUpdate;
766 public event AvatarNotesUpdate OnAvatarNotesUpdate;
767 public event MuteListRequest OnMuteListRequest;
768 public event AvatarInterestUpdate OnAvatarInterestUpdate;
769 public event FindAgentUpdate OnFindAgent;
770 public event TrackAgentUpdate OnTrackAgent;
771 public event NewUserReport OnUserReport;
772 public event SaveStateHandler OnSaveState;
773 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest;
774 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest;
775 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest;
776 public event FreezeUserUpdate OnParcelFreezeUser;
777 public event EjectUserUpdate OnParcelEjectUser;
778 public event ParcelBuyPass OnParcelBuyPass;
779 public event ParcelGodMark OnParcelGodMark;
780 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest;
781 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
782 public event SimWideDeletesDelegate OnSimWideDeletes;
783 public event SendPostcard OnSendPostcard;
784 public event MuteListEntryUpdate OnUpdateMuteListEntry;
785 public event MuteListEntryRemove OnRemoveMuteListEntry;
786 public event GodlikeMessage onGodlikeMessage;
787 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
788
789 public event PlacesQuery OnPlacesQuery;
790
791 #pragma warning restore 67
792
793 #endregion
794
795 #region OpenSim ClientView Public Methods
796 // Do we need this?
797 public bool SendLogoutPacketWhenClosing
798 {
799 set { }
800 }
801
802 public uint CircuitCode
803 {
804 get { return m_sessionID.CRC(); }
805 }
806
807 public IPEndPoint RemoteEndPoint
808 {
809 get { return Session.RemoteEndPoint; }
810 }
811
812 public void SetDebugPacketLevel(int newDebug)
813 {
814 //m_debugLevel = newDebug;
815 }
816
817 public void InPacket(object NewPack)
818 {
819 //throw new System.NotImplementedException();
820 }
821
822 public void ProcessInPacket(Packet NewPack)
823 {
824 //throw new System.NotImplementedException();
825 }
826
827 public void OnClean()
828 {
829 if (OnLogout != null)
830 OnLogout(this);
831
832 if (OnConnectionClosed != null)
833 OnConnectionClosed(this);
834 }
835
836 public void Close()
837 {
838 m_log.Info("[MXP ClientStack] Close Called");
839
840 // Tell the client to go
841 SendLogoutPacket();
842
843 // Let MXPPacketServer clean it up
844 if (Session.SessionState != SessionState.Disconnected)
845 {
846 Session.SetStateDisconnected();
847 }
848
849 }
850
851 public void Kick(string message)
852 {
853 Close();
854 }
855
856 public void Start()
857 {
858 Scene.AddNewClient(this);
859
860 // Mimicking LLClientView which gets always set appearance from client.
861 OpenSim.Region.Framework.Scenes.Scene scene=(OpenSim.Region.Framework.Scenes.Scene)Scene;
862 AvatarAppearance appearance;
863 scene.GetAvatarAppearance(this,out appearance);
864 OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone());
865 }
866
867 public void Stop()
868 {
869 // Nor this
870 }
871
872 public void SendWearables(AvatarWearable[] wearables, int serial)
873 {
874 // Need to translate to MXP somehow
875 }
876
877 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
878 {
879 // Need to translate to MXP somehow
880 }
881
882 public void SendStartPingCheck(byte seq)
883 {
884 // Need to translate to MXP somehow
885 }
886
887 public void SendKillObject(ulong regionHandle, uint localID)
888 {
889 DisappearanceEventMessage de = new DisappearanceEventMessage();
890 de.ObjectIndex = localID;
891
892 Session.Send(de);
893 }
894
895 public void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
896 {
897 // Need to translate to MXP somehow
898 }
899
900 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
901 {
902 m_log.Info("[MXP ClientStack] Completing Handshake to Region");
903
904 if (OnRegionHandShakeReply != null)
905 {
906 OnRegionHandShakeReply(this);
907 }
908
909 if (OnCompleteMovementToRegion != null)
910 {
911 OnCompleteMovementToRegion(this);
912 }
913
914 // Need to translate to MXP somehow
915 }
916
917 public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, byte audible)
918 {
919 ActionEventMessage chatActionEvent = new ActionEventMessage();
920 chatActionEvent.ActionFragment.ActionName = "Chat";
921 chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid;
922 chatActionEvent.ActionFragment.ObservationRadius = 180.0f;
923 chatActionEvent.ActionFragment.ExtensionDialect = "TEXT";
924 chatActionEvent.SetPayloadData(Util.UTF8.GetBytes(message));
925
926 Session.Send(chatActionEvent);
927 }
928
929 public void SendInstantMessage(GridInstantMessage im)
930 {
931 // Need to translate to MXP somehow
932 }
933
934 public void SendGenericMessage(string method, List<string> message)
935 {
936 }
937
938 public void SendGenericMessage(string method, List<byte[]> message)
939 {
940 // Need to translate to MXP somehow
941 }
942
943 public void SendLayerData(float[] map)
944 {
945 MXPSendTerrain(map);
946 }
947
948 public void SendLayerData(int px, int py, float[] map)
949 {
950 }
951
952 public void SendWindData(Vector2[] windSpeeds)
953 {
954 // Need to translate to MXP somehow
955 }
956
957 public void SendCloudData(float[] cloudCover)
958 {
959 // Need to translate to MXP somehow
960 }
961
962 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
963 {
964 //throw new System.NotImplementedException();
965 }
966
967 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
968 {
969 //throw new System.NotImplementedException();
970 }
971
972 public AgentCircuitData RequestClientInfo()
973 {
974 AgentCircuitData clientinfo = new AgentCircuitData();
975 clientinfo.AgentID = AgentId;
976 clientinfo.Appearance = new AvatarAppearance();
977 clientinfo.BaseFolder = UUID.Zero;
978 clientinfo.CapsPath = "";
979 clientinfo.child = false;
980 clientinfo.ChildrenCapSeeds = new Dictionary<ulong, string>();
981 clientinfo.circuitcode = CircuitCode;
982 clientinfo.firstname = FirstName;
983 clientinfo.InventoryFolder = UUID.Zero;
984 clientinfo.lastname = LastName;
985 clientinfo.SecureSessionID = SecureSessionId;
986 clientinfo.SessionID = SessionId;
987 clientinfo.startpos = StartPos;
988
989 return clientinfo;
990 }
991
992 public void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL)
993 {
994 // TODO: We'll want to get this one working.
995 // Need to translate to MXP somehow
996 }
997
998 public void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
999 {
1000 // Need to translate to MXP somehow
1001 }
1002
1003 public void SendLocalTeleport(Vector3 position, Vector3 lookAt, uint flags)
1004 {
1005 //throw new System.NotImplementedException();
1006 }
1007
1008 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL)
1009 {
1010 // Need to translate to MXP somehow
1011 }
1012
1013 public void SendTeleportFailed(string reason)
1014 {
1015 // Need to translate to MXP somehow
1016 }
1017
1018 public void SendTeleportStart(uint flags)
1019 {
1020 // Need to translate to MXP somehow
1021 }
1022
1023 public void SendTeleportProgress(uint flags, string message)
1024 {
1025 }
1026
1027 public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
1028 {
1029 // Need to translate to MXP somehow
1030 }
1031
1032 public void SendPayPrice(UUID objectID, int[] payPrice)
1033 {
1034 // Need to translate to MXP somehow
1035 }
1036
1037 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
1038 {
1039 // Minimap function, not used.
1040 }
1041
1042 public void SetChildAgentThrottle(byte[] throttle)
1043 {
1044 // Need to translate to MXP somehow
1045 }
1046
1047 public void SendAvatarDataImmediate(ISceneEntity avatar)
1048 {
1049 //ScenePresence presence=((Scene)this.Scene).GetScenePresence(avatarID);
1050 ScenePresence presence = (ScenePresence)avatar;
1051 UUID ownerID = presence.UUID;
1052 MXPSendAvatarData(presence.Firstname + " " + presence.Lastname, ownerID, UUID.Zero, presence.UUID, presence.LocalId, presence.AbsolutePosition, presence.Rotation);
1053 }
1054
1055 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
1056 {
1057 //MovementEventMessage me = new MovementEventMessage();
1058 //me.ObjectIndex = data.LocalID;
1059 //me.Location = ToOmVector(data.Position);
1060 //me.Orientation = ToOmQuaternion(data.Rotation);
1061
1062 //MXPSendPrimitive(data.localID, data.ownerID, data.acc, data.rvel, data.primShape, data.pos, data.objectID, data.vel,
1063 // data.rotation, (uint)data.flags, data.text, data.color, data.parentID, data.particleSystem, data.clickAction,
1064 // data.material, data.textureanim);
1065
1066 //Session.Send(me);
1067
1068 throw new System.NotImplementedException();
1069 }
1070
1071 public void ReprioritizeUpdates()
1072 {
1073 }
1074
1075 public void FlushPrimUpdates()
1076 {
1077 }
1078
1079 public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int version, bool fetchFolders, bool fetchItems)
1080 {
1081 // Need to translate to MXP somehow
1082 }
1083
1084 public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
1085 {
1086 // Need to translate to MXP somehow
1087 }
1088
1089 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
1090 {
1091 // Need to translate to MXP somehow
1092 }
1093
1094 public void SendRemoveInventoryItem(UUID itemID)
1095 {
1096 // Need to translate to MXP somehow
1097 }
1098
1099 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
1100 {
1101 // Need to translate to MXP somehow
1102 }
1103
1104 public void SendTaskInventory(UUID taskID, short serial, byte[] fileName)
1105 {
1106 // Need to translate to MXP somehow
1107 }
1108
1109 public void SendBulkUpdateInventory(InventoryNodeBase node)
1110 {
1111 // Need to translate to MXP somehow
1112 }
1113
1114 public void SendXferPacket(ulong xferID, uint packet, byte[] data)
1115 {
1116 // SL Specific, Ignore. (Remove from IClient)
1117 }
1118
1119 public void SendAbortXferPacket(ulong xferID)
1120 {
1121
1122 }
1123
1124
1125 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
1126 {
1127 // SL Specific, Ignore. (Remove from IClient)
1128 }
1129
1130 public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
1131 {
1132 // Need to translate to MXP somehow
1133 }
1134
1135 public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
1136 {
1137 // Need to translate to MXP somehow
1138 // TODO: This may need doing - involves displaying the users avatar name
1139 }
1140
1141 public void SendPreLoadSound(UUID objectID, UUID ownerID, UUID soundID)
1142 {
1143 // Need to translate to MXP somehow
1144 }
1145
1146 public void SendPlayAttachedSound(UUID soundID, UUID objectID, UUID ownerID, float gain, byte flags)
1147 {
1148 // Need to translate to MXP somehow
1149 }
1150
1151 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
1152 {
1153 // Need to translate to MXP somehow
1154 }
1155
1156 public void SendAttachedSoundGainChange(UUID objectID, float gain)
1157 {
1158 // Need to translate to MXP somehow
1159 }
1160
1161 public void SendNameReply(UUID profileId, string firstname, string lastname)
1162 {
1163 // SL Specific
1164 }
1165
1166 public void SendAlertMessage(string message)
1167 {
1168 SendChatMessage(message, 0, Vector3.Zero, "System", UUID.Zero, 0, 0);
1169 }
1170
1171 public void SendAgentAlertMessage(string message, bool modal)
1172 {
1173 SendChatMessage(message, 0, Vector3.Zero, "System" + (modal ? " Notice" : ""), UUID.Zero, 0, 0);
1174 }
1175
1176 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
1177 {
1178 // TODO: Probably can do this better
1179 SendChatMessage("Please visit: " + url, 0, Vector3.Zero, objectname, UUID.Zero, 0, 0);
1180 }
1181
1182 public void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
1183 {
1184 // TODO: Probably can do this better
1185 SendChatMessage("Dialog: " + msg, 0, Vector3.Zero, objectname, UUID.Zero, 0, 0);
1186 }
1187
1188 public bool AddMoney(int debit)
1189 {
1190 SendChatMessage("You were paid: " + debit, 0, Vector3.Zero, "System", UUID.Zero, 0, 0);
1191 return true;
1192 }
1193
1194 public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition)
1195 {
1196 // Need to translate to MXP somehow
1197 // Send a light object?
1198 }
1199
1200 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
1201 {
1202 // Need to translate to MXP somehow
1203 }
1204
1205 public void SendViewerTime(int phase)
1206 {
1207 // Need to translate to MXP somehow
1208 }
1209
1210 public UUID GetDefaultAnimation(string name)
1211 {
1212 return UUID.Zero;
1213 }
1214
1215 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
1216 {
1217 // Need to translate to MXP somehow
1218 }
1219
1220 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
1221 {
1222 // Need to translate to MXP somehow
1223 }
1224
1225 public void SendHealth(float health)
1226 {
1227 // Need to translate to MXP somehow
1228 }
1229
1230 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
1231 {
1232 // Need to translate to MXP somehow
1233 }
1234
1235 public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
1236 {
1237 // Need to translate to MXP somehow
1238 }
1239
1240 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
1241 {
1242 // Need to translate to MXP somehow
1243 }
1244
1245 public void SendEstateCovenantInformation(UUID covenant)
1246 {
1247 // Need to translate to MXP somehow
1248 }
1249
1250 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
1251 {
1252 // Need to translate to MXP somehow
1253 }
1254
1255 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
1256 {
1257 // Need to translate to MXP somehow
1258 }
1259
1260 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
1261 {
1262 // Need to translate to MXP somehow
1263 }
1264
1265 public void SendForceClientSelectObjects(List<uint> objectIDs)
1266 {
1267 // Need to translate to MXP somehow
1268 }
1269
1270 public void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount)
1271 {
1272 // Need to translate to MXP somehow
1273 }
1274
1275 public void SendCameraConstraint(Vector4 ConstraintPlane)
1276 {
1277
1278 }
1279
1280 public void SendLandParcelOverlay(byte[] data, int sequence_id)
1281 {
1282 // Need to translate to MXP somehow
1283 }
1284
1285 public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
1286 {
1287 // Need to translate to MXP somehow
1288 }
1289
1290 public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, byte autoScale, string mediaType, string mediaDesc, int mediaWidth, int mediaHeight, byte mediaLoop)
1291 {
1292 // Need to translate to MXP somehow
1293 }
1294
1295 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
1296 {
1297 // Need to translate to MXP somehow
1298 }
1299
1300 public void SendConfirmXfer(ulong xferID, uint PacketID)
1301 {
1302 // Need to translate to MXP somehow
1303 }
1304
1305 public void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName)
1306 {
1307 // Need to translate to MXP somehow
1308 }
1309
1310 public void SendInitiateDownload(string simFileName, string clientFileName)
1311 {
1312 // Need to translate to MXP somehow
1313 }
1314
1315 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
1316 {
1317 // Need to translate to MXP somehow
1318 }
1319
1320 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
1321 {
1322 // Need to translate to MXP somehow
1323 }
1324
1325 public void SendImageNotFound(UUID imageid)
1326 {
1327 // Need to translate to MXP somehow
1328 }
1329
1330 public void SendShutdownConnectionNotice()
1331 {
1332 // Need to translate to MXP somehow
1333 }
1334
1335 public void SendSimStats(SimStats stats)
1336 {
1337 // Need to translate to MXP somehow
1338 }
1339
1340 public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
1341 {
1342 //throw new System.NotImplementedException();
1343 }
1344
1345 public void SendObjectPropertiesReply(ISceneEntity entity)
1346 {
1347 //throw new System.NotImplementedException();
1348 }
1349
1350 public void SendAgentOffline(UUID[] agentIDs)
1351 {
1352 // Need to translate to MXP somehow (Friends List)
1353 }
1354
1355 public void SendAgentOnline(UUID[] agentIDs)
1356 {
1357 // Need to translate to MXP somehow (Friends List)
1358 }
1359
1360 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot, Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
1361 {
1362 // Need to translate to MXP somehow
1363 }
1364
1365 public void SendAdminResponse(UUID Token, uint AdminLevel)
1366 {
1367 // Need to translate to MXP somehow
1368 }
1369
1370 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
1371 {
1372 // Need to translate to MXP somehow
1373 }
1374
1375 public void SendGroupNameReply(UUID groupLLUID, string GroupName)
1376 {
1377 // Need to translate to MXP somehow
1378 }
1379
1380 public void SendJoinGroupReply(UUID groupID, bool success)
1381 {
1382 // Need to translate to MXP somehow
1383 }
1384
1385 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
1386 {
1387 // Need to translate to MXP somehow
1388 }
1389
1390 public void SendLeaveGroupReply(UUID groupID, bool success)
1391 {
1392 // Need to translate to MXP somehow
1393 }
1394
1395 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
1396 {
1397 // Need to translate to MXP somehow
1398 }
1399
1400 public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
1401 {
1402 // Need to translate to MXP somehow
1403 }
1404
1405 public void SendAsset(AssetRequestToClient req)
1406 {
1407 // Need to translate to MXP somehow
1408 }
1409
1410 public void SendTexture(AssetBase TextureAsset)
1411 {
1412 // Need to translate to MXP somehow
1413 }
1414
1415 public byte[] GetThrottlesPacked(float multiplier)
1416 {
1417 // LL Specific, get out of IClientAPI
1418
1419 const int singlefloat = 4;
1420 float tResend = multiplier;
1421 float tLand = multiplier;
1422 float tWind = multiplier;
1423 float tCloud = multiplier;
1424 float tTask = multiplier;
1425 float tTexture = multiplier;
1426 float tAsset = multiplier;
1427
1428 byte[] throttles = new byte[singlefloat * 7];
1429 int i = 0;
1430 Buffer.BlockCopy(BitConverter.GetBytes(tResend), 0, throttles, singlefloat * i, singlefloat);
1431 i++;
1432 Buffer.BlockCopy(BitConverter.GetBytes(tLand), 0, throttles, singlefloat * i, singlefloat);
1433 i++;
1434 Buffer.BlockCopy(BitConverter.GetBytes(tWind), 0, throttles, singlefloat * i, singlefloat);
1435 i++;
1436 Buffer.BlockCopy(BitConverter.GetBytes(tCloud), 0, throttles, singlefloat * i, singlefloat);
1437 i++;
1438 Buffer.BlockCopy(BitConverter.GetBytes(tTask), 0, throttles, singlefloat * i, singlefloat);
1439 i++;
1440 Buffer.BlockCopy(BitConverter.GetBytes(tTexture), 0, throttles, singlefloat * i, singlefloat);
1441 i++;
1442 Buffer.BlockCopy(BitConverter.GetBytes(tAsset), 0, throttles, singlefloat * i, singlefloat);
1443
1444 return throttles;
1445 }
1446
1447 public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message)
1448 {
1449 SendChatMessage(Message, 0, Vector3.Zero, FromAvatarName, UUID.Zero, 0, 0);
1450 }
1451
1452 public void SendLogoutPacket()
1453 {
1454 LeaveRequestMessage lrm = new LeaveRequestMessage();
1455 Session.Send(lrm);
1456 }
1457
1458 public EndPoint GetClientEP()
1459 {
1460 return null;
1461 }
1462
1463 public ClientInfo GetClientInfo()
1464 {
1465 return null;
1466 //throw new System.NotImplementedException();
1467 }
1468
1469 public void SetClientInfo(ClientInfo info)
1470 {
1471 //throw new System.NotImplementedException();
1472 }
1473
1474 public void SetClientOption(string option, string value)
1475 {
1476 // Need to translate to MXP somehow
1477 }
1478
1479 public string GetClientOption(string option)
1480 {
1481 // Need to translate to MXP somehow
1482 return "";
1483 }
1484
1485 public void Terminate()
1486 {
1487 Close();
1488 }
1489
1490 public void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters)
1491 {
1492 // Need to translate to MXP somehow
1493 }
1494
1495 public void SendClearFollowCamProperties(UUID objectID)
1496 {
1497 // Need to translate to MXP somehow
1498 }
1499
1500 public void SendRegionHandle(UUID regoinID, ulong handle)
1501 {
1502 // Need to translate to MXP somehow
1503 }
1504
1505 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
1506 {
1507 // Need to translate to MXP somehow
1508 }
1509
1510 public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
1511 {
1512 // Need to translate to MXP somehow
1513 }
1514
1515 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
1516 {
1517 // Need to translate to MXP somehow
1518 }
1519
1520 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
1521 {
1522 // Need to translate to MXP somehow
1523 }
1524
1525 public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
1526 {
1527 // Need to translate to MXP somehow
1528 }
1529
1530 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
1531 {
1532 // Need to translate to MXP somehow
1533 }
1534
1535 public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
1536 {
1537 // Need to translate to MXP somehow
1538 }
1539
1540 public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
1541 {
1542 // Need to translate to MXP somehow
1543 }
1544
1545 public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
1546 {
1547 // Need to translate to MXP somehow
1548 }
1549
1550 public void SendEventInfoReply(EventData info)
1551 {
1552 // Need to translate to MXP somehow
1553 }
1554
1555 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
1556 {
1557 // Need to translate to MXP somehow
1558 }
1559
1560 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
1561 {
1562 // Need to translate to MXP somehow
1563 }
1564
1565 public void SendOfferCallingCard(UUID srcID, UUID transactionID)
1566 {
1567 // Need to translate to MXP somehow
1568 }
1569
1570 public void SendAcceptCallingCard(UUID transactionID)
1571 {
1572 // Need to translate to MXP somehow
1573 }
1574
1575 public void SendDeclineCallingCard(UUID transactionID)
1576 {
1577 // Need to translate to MXP somehow
1578 }
1579
1580 public void SendTerminateFriend(UUID exFriendID)
1581 {
1582 // Need to translate to MXP somehow
1583 }
1584
1585 public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
1586 {
1587 // Need to translate to MXP somehow
1588 }
1589
1590 public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
1591 {
1592 // Need to translate to MXP somehow
1593 }
1594
1595 public void SendAgentDropGroup(UUID groupID)
1596 {
1597 // Need to translate to MXP somehow
1598 }
1599
1600 public void SendAvatarNotesReply(UUID targetID, string text)
1601 {
1602 // Need to translate to MXP somehow
1603 }
1604
1605 public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
1606 {
1607 // Need to translate to MXP somehow
1608 }
1609
1610 public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
1611 {
1612 // Need to translate to MXP somehow
1613 }
1614
1615 public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
1616 {
1617 // Need to translate to MXP somehow
1618 }
1619
1620 public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
1621 {
1622 // Need to translate to MXP somehow
1623 }
1624
1625 public void KillEndDone()
1626 {
1627 Stop();
1628 }
1629
1630 public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
1631 {
1632 // Need to translate to MXP somehow
1633 return true;
1634 }
1635
1636 #endregion
1637
1638 #region IClientCore
1639
1640 public bool TryGet<T>(out T iface)
1641 {
1642 iface = default(T);
1643 return false;
1644 }
1645
1646 public T Get<T>()
1647 {
1648 return default(T);
1649 }
1650
1651 public void Disconnect(string reason)
1652 {
1653 Kick(reason);
1654 Close();
1655 }
1656
1657 public void Disconnect()
1658 {
1659 Close();
1660 }
1661
1662 #endregion
1663
1664 public void SendCreateGroupReply(UUID groupID, bool success, string message)
1665 {
1666 }
1667
1668 public void RefreshGroupMembership()
1669 {
1670 }
1671
1672 public void SendUseCachedMuteList()
1673 {
1674 }
1675
1676 public void SendMuteListUpdate(string filename)
1677 {
1678 }
1679
1680 public void SendPickInfoReply(UUID pickID,UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled)
1681 {
1682 }
1683
1684 public void SendRebakeAvatarTextures(UUID textureID)
1685 {
1686 }
1687
1688 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
1689 {
1690 }
1691
1692 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1693 {
1694 }
1695
1696 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1697 {
1698 }
1699
1700 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1701 {
1702 }
1703
1704 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1705 {
1706 }
1707
1708 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1709 {
1710 }
1711
1712 public void SendChangeUserRights(UUID agentID, UUID friendID, int rights)
1713 {
1714 }
1715
1716 public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
1717 {
1718 }
1719
1720 public void StopFlying(ISceneEntity presence)
1721 {
1722 }
1723
1724 public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
1725 {
1726 }
1727 }
1728}
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs
deleted file mode 100644
index 0b442cc..0000000
--- a/OpenSim/Client/MXP/MXPModule.cs
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using System.Timers;
33using log4net;
34using MXP;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Client.MXP.PacketHandler;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40
41namespace OpenSim.Client.MXP
42{
43
44 /**
45 * MXP Client Module which adds MXP support to client / region communication.
46 */
47 public class MXPModule : IRegionModule
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private MXPPacketServer m_server;
52
53 private IConfigSource m_config;
54 private int m_port = 1253;
55 private Timer m_ticker;
56
57 private readonly Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
58 private bool m_shutdown;
59
60 public void Initialise(Scene scene, IConfigSource source)
61 {
62 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
63 m_scenes.Add(scene.RegionInfo.RegionID, scene);
64
65 m_config = source;
66 }
67
68 public void PostInitialise()
69 {
70 if (m_config.Configs["MXP"] != null)
71 {
72 IConfig con = m_config.Configs["MXP"];
73
74 if (!con.GetBoolean("Enabled", false))
75 return;
76
77 m_port = con.GetInt("Port", m_port);
78
79 m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true));
80
81 m_ticker = new Timer(100);
82 m_ticker.AutoReset = false;
83 m_ticker.Elapsed += ticker_Elapsed;
84
85 lock (m_ticker)
86 m_ticker.Start();
87
88 m_log.Info("[MXP ClientStack] MXP Enabled and Listening");
89 }
90 }
91
92 void ticker_Elapsed(object sender, ElapsedEventArgs e)
93 {
94 try
95 {
96 m_server.Process();
97 }
98 catch (Exception ex)
99 {
100 m_log.Error("[MXP ClientStack]: Unhandled exception in process loop: " + ex.ToString() + " :" + ex.StackTrace.ToString());
101 }
102
103 if (!m_shutdown)
104 {
105 lock (m_ticker)
106 m_ticker.Start();
107 }
108 }
109
110 public void Close()
111 {
112 m_shutdown = true;
113 if (m_ticker != null)
114 {
115 lock (m_ticker)
116 m_ticker.Stop();
117 }
118 }
119
120 public string Name
121 {
122 get { return "MXP ClientStack Module"; }
123 }
124
125 public bool IsSharedModule
126 {
127 get { return true; }
128 }
129
130 }
131}
diff --git a/OpenSim/Client/MXP/MXPUtil.cs b/OpenSim/Client/MXP/MXPUtil.cs
deleted file mode 100644
index 3387145..0000000
--- a/OpenSim/Client/MXP/MXPUtil.cs
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenMetaverse;
32
33namespace OpenSim.Client.MXP
34{
35 public static class MXPUtil
36 {
37 public static string GenerateMXPURL(string server, int port, UUID bubbleID, Vector3 location)
38 {
39 return string.Format("mxp://{0}:{1}/{2}/{3}", server, port, bubbleID.Guid, location);
40 }
41 }
42}
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
deleted file mode 100644
index dcecb8b..0000000
--- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs
+++ /dev/null
@@ -1,561 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* This file borrows heavily from MXPServer.cs - the reference MXPServer
29 * See http://www.bubblecloud.org for a copy of the original file and
30 * implementation details. */
31
32using System;
33using System.Collections.Generic;
34using System.Reflection;
35using System.Threading;
36using log4net;
37using MXP;
38using MXP.Messages;
39using OpenMetaverse;
40using OpenSim.Client.MXP.ClientStack;
41using OpenSim.Framework;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Framework.Communications;
44using OpenSim.Services.Interfaces;
45using System.Security.Cryptography;
46
47namespace OpenSim.Client.MXP.PacketHandler
48{
49 public class MXPPacketServer
50 {
51 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 #region Fields
54
55 private readonly List<MXPClientView> m_clients = new List<MXPClientView>();
56 private readonly Dictionary<UUID, Scene> m_scenes;
57 private readonly Transmitter m_transmitter;
58
59// private readonly Thread m_clientThread;
60
61 private readonly IList<Session> m_sessions = new List<Session>();
62 private readonly IList<Session> m_sessionsToClient = new List<Session>();
63 private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
64
65 private readonly int m_port;
66// private readonly bool m_accountsAuthenticate;
67
68 private readonly String m_programName;
69 private readonly byte m_programMajorVersion;
70 private readonly byte m_programMinorVersion;
71
72 #endregion
73
74 #region Constructors
75
76 public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate)
77 {
78 m_port = port;
79// m_accountsAuthenticate = accountsAuthenticate;
80
81 m_scenes = scenes;
82
83 m_programMinorVersion = 63;
84 m_programMajorVersion = 0;
85 m_programName = "OpenSimulator";
86
87 m_transmitter = new Transmitter(port);
88
89 StartListener();
90 }
91
92 public void StartListener()
93 {
94 m_log.Info("[MXP ClientStack] Transmitter starting on UDP server port: " + m_port);
95 m_transmitter.Startup();
96 m_log.Info("[MXP ClientStack] Transmitter started. MXP version: "+MxpConstants.ProtocolMajorVersion+"."+MxpConstants.ProtocolMinorVersion+" Source Revision: "+MxpConstants.ProtocolSourceRevision);
97 }
98
99 #endregion
100
101 #region Properties
102
103 /// <summary>
104 /// Number of sessions pending. (Process() accepts pending sessions).
105 /// </summary>
106 public int PendingSessionCount
107 {
108 get
109 {
110 return m_transmitter.PendingSessionCount;
111 }
112 }
113 /// <summary>
114 /// Number of connected sessions.
115 /// </summary>
116 public int SessionCount
117 {
118 get
119 {
120 return m_sessions.Count;
121 }
122 }
123 /// <summary>
124 /// Property reflecting whether client transmitter threads are alive.
125 /// </summary>
126 public bool IsTransmitterAlive
127 {
128 get
129 {
130 return m_transmitter != null && m_transmitter.IsAlive;
131 }
132 }
133 /// <summary>
134 /// Number of packets sent.
135 /// </summary>
136 public ulong PacketsSent
137 {
138 get
139 {
140 return m_transmitter != null ? m_transmitter.PacketsSent : 0;
141 }
142 }
143 /// <summary>
144 /// Number of packets received.
145 /// </summary>
146 public ulong PacketsReceived
147 {
148 get
149 {
150 return m_transmitter != null ? m_transmitter.PacketsReceived : 0;
151 }
152 }
153 /// <summary>
154 /// Bytes client has received so far.
155 /// </summary>
156 public ulong BytesReceived
157 {
158 get
159 {
160 return m_transmitter != null ? m_transmitter.BytesReceived : 0;
161 }
162 }
163 /// <summary>
164 /// Bytes client has sent so far.
165 /// </summary>
166 public ulong BytesSent
167 {
168 get
169 {
170 return m_transmitter != null ? m_transmitter.BytesSent : 0;
171 }
172 }
173 /// <summary>
174 /// Number of bytes received (bytes per second) during past second.
175 /// </summary>
176 public double ReceiveRate
177 {
178 get
179 {
180 return m_transmitter != null ? m_transmitter.ReceiveRate : 0;
181 }
182 }
183 /// <summary>
184 /// Number of bytes sent (bytes per second) during past second.
185 /// </summary>
186 public double SendRate
187 {
188 get
189 {
190 return m_transmitter != null ? m_transmitter.SendRate : 0;
191 }
192 }
193
194 #endregion
195
196 #region Session Management
197
198 public void Disconnect(Session session)
199 {
200 if (session.IsConnected)
201 {
202 Message message = MessageFactory.Current.ReserveMessage(typeof(LeaveRequestMessage));
203 session.Send(message);
204 MessageFactory.Current.ReleaseMessage(message);
205 }
206 else
207 {
208 throw new Exception("Not connected.");
209 }
210 }
211
212 #endregion
213
214 #region Processing
215
216 public void Process()
217 {
218 ProcessMessages();
219 Clean();
220 }
221
222 public void Clean()
223 {
224 foreach (MXPClientView clientView in m_clients)
225 {
226 if (clientView.Session.SessionState == SessionState.Disconnected)
227 {
228 m_sessionsToRemove.Add(clientView);
229 }
230 }
231
232 foreach (MXPClientView clientView in m_sessionsToRemove)
233 {
234 clientView.Scene.RemoveClient(clientView.AgentId);
235 clientView.OnClean();
236 m_clients.Remove(clientView);
237 m_sessions.Remove(clientView.Session);
238 }
239
240 m_sessionsToRemove.Clear();
241 }
242
243 public void ProcessMessages()
244 {
245 if (m_transmitter.PendingSessionCount > 0)
246 {
247 Session tmp = m_transmitter.AcceptPendingSession();
248 m_sessions.Add(tmp);
249 m_sessionsToClient.Add(tmp);
250
251 }
252
253 List<Session> tmpRemove = new List<Session>();
254
255 foreach (Session session in m_sessionsToClient)
256 {
257 while (session.AvailableMessages > 0)
258 {
259 Message message = session.Receive();
260
261 if (message.GetType() == typeof (JoinRequestMessage))
262 {
263
264 JoinRequestMessage joinRequestMessage = (JoinRequestMessage) message;
265
266 m_log.Info("[MXP ClientStack]: Session join request: " + session.SessionId + " (" +
267 (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
268 session.RemoteEndPoint.Port + ")");
269
270 try
271 {
272
273 if (joinRequestMessage.BubbleId == Guid.Empty)
274 {
275 foreach (Scene scene in m_scenes.Values)
276 {
277 if (scene.RegionInfo.RegionName == joinRequestMessage.BubbleName)
278 {
279 m_log.Info("[MXP ClientStack]: Resolved region by name: " + joinRequestMessage.BubbleName + " (" + scene.RegionInfo.RegionID + ")");
280 joinRequestMessage.BubbleId = scene.RegionInfo.RegionID.Guid;
281 }
282 }
283 }
284
285 if (joinRequestMessage.BubbleId == Guid.Empty)
286 {
287 m_log.Warn("[MXP ClientStack]: Failed to resolve region by name: " + joinRequestMessage.BubbleName);
288 }
289
290 UUID sceneId = new UUID(joinRequestMessage.BubbleId);
291
292 bool regionExists = true;
293 if (!m_scenes.ContainsKey(sceneId))
294 {
295 m_log.Info("[MXP ClientStack]: No such region: " + sceneId);
296 regionExists = false;
297 }
298
299 UUID userId = UUID.Zero;
300 UserAccount account = null;
301 bool authorized = regionExists ? AuthoriseUser(joinRequestMessage.ParticipantName,
302 joinRequestMessage.ParticipantPassphrase,
303 new UUID(joinRequestMessage.BubbleId), out account)
304 : false;
305
306 if (authorized)
307 {
308 Scene scene = m_scenes[sceneId];
309 UUID mxpSessionID = UUID.Random();
310
311 string reason;
312
313 m_log.Debug("[MXP ClientStack]: Session join request success: " + session.SessionId + " (" +
314 (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
315 session.RemoteEndPoint.Port + ")");
316
317 m_log.Debug("[MXP ClientStack]: Attaching UserAgent to UserProfile...");
318 UUID secureSession = UUID.Zero;
319 AttachUserAgentToUserProfile(account, session, mxpSessionID, sceneId, out secureSession);
320 m_log.Debug("[MXP ClientStack]: Attached UserAgent to UserProfile.");
321 m_log.Debug("[MXP ClientStack]: Preparing Scene to Connection...");
322 if (!PrepareSceneForConnection(mxpSessionID, secureSession, sceneId, account, out reason))
323 {
324 m_log.DebugFormat("[MXP ClientStack]: Scene refused connection: {0}", reason);
325 DeclineConnection(session, joinRequestMessage);
326 tmpRemove.Add(session);
327 continue;
328 }
329 m_log.Debug("[MXP ClientStack]: Prepared Scene to Connection.");
330 m_log.Debug("[MXP ClientStack]: Accepting connection...");
331 AcceptConnection(session, joinRequestMessage, mxpSessionID, userId);
332 m_log.Info("[MXP ClientStack]: Accepted connection.");
333
334 m_log.Debug("[MXP ClientStack]: Creating ClientView....");
335 MXPClientView client = new MXPClientView(session, mxpSessionID, userId, scene, account.FirstName, account.LastName);
336 m_clients.Add(client);
337 m_log.Debug("[MXP ClientStack]: Created ClientView.");
338
339 client.MXPSendSynchronizationBegin(m_scenes[new UUID(joinRequestMessage.BubbleId)].SceneContents.GetTotalObjectsCount());
340
341 m_log.Debug("[MXP ClientStack]: Starting ClientView...");
342 try
343 {
344 client.Start();
345 m_log.Debug("[MXP ClientStack]: Started ClientView.");
346 }
347 catch (Exception e)
348 {
349 m_log.Error(e);
350 }
351
352 m_log.Debug("[MXP ClientStack]: Connected");
353 }
354 else
355 {
356 m_log.Info("[MXP ClientStack]: Session join request failure: " + session.SessionId + " (" +
357 (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
358 session.RemoteEndPoint.Port + ")");
359
360 DeclineConnection(session, joinRequestMessage);
361 }
362 }
363 catch (Exception e)
364 {
365 m_log.Error("[MXP ClientStack]: Session join request failure: " + session.SessionId + " (" +
366 (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" +
367 session.RemoteEndPoint.Port + "): "+e.ToString()+" :"+e.StackTrace.ToString());
368 }
369 tmpRemove.Add(session);
370 }
371 }
372 }
373
374 foreach (Session session in tmpRemove)
375 {
376 m_sessionsToClient.Remove(session);
377 }
378
379 foreach (MXPClientView clientView in m_clients)
380 {
381 int messagesProcessedCount = 0;
382 Session session = clientView.Session;
383
384 while (session.AvailableMessages > 0)
385 {
386 Message message = session.Receive();
387
388 if (message.GetType() == typeof(LeaveRequestMessage))
389 {
390 LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)MessageFactory.Current.ReserveMessage(
391 typeof(LeaveResponseMessage));
392
393 m_log.Debug("[MXP ClientStack]: Session leave request: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
394
395 leaveResponseMessage.RequestMessageId = message.MessageId;
396 leaveResponseMessage.FailureCode = 0;
397 session.Send(leaveResponseMessage);
398
399 if (session.SessionState != SessionState.Disconnected)
400 {
401 session.SetStateDisconnected();
402 }
403
404 m_log.Debug("[MXP ClientStack]: Removing Client from Scene");
405 //clientView.Scene.RemoveClient(clientView.AgentId);
406 }
407 if (message.GetType() == typeof(LeaveResponseMessage))
408 {
409 LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)message;
410
411 m_log.Debug("[MXP ClientStack]: Session leave response: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")");
412
413 if (leaveResponseMessage.FailureCode == 0)
414 {
415 session.SetStateDisconnected();
416 }
417
418 m_log.Debug("[MXP ClientStack]: Removing Client from Scene");
419 //clientView.Scene.RemoveClient(clientView.AgentId);
420 }
421 else
422 {
423 clientView.MXPPRocessMessage(message);
424 }
425
426 MessageFactory.Current.ReleaseMessage(message);
427 messagesProcessedCount++;
428 if (messagesProcessedCount > 1000)
429 {
430 break;
431 }
432 }
433 }
434 }
435
436 private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID, UUID userId)
437 {
438 JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(
439 typeof(JoinResponseMessage));
440
441 joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
442 joinResponseMessage.FailureCode = MxpResponseCodes.SUCCESS;
443
444 joinResponseMessage.BubbleId = joinRequestMessage.BubbleId;
445 joinResponseMessage.ParticipantId = userId.Guid;
446 joinResponseMessage.AvatarId = userId.Guid;
447 joinResponseMessage.BubbleAssetCacheUrl = "http://" +
448 NetworkUtil.GetHostFor(session.RemoteEndPoint.Address,
449 m_scenes[
450 new UUID(joinRequestMessage.BubbleId)].
451 RegionInfo.
452 ExternalHostName) + ":" +
453 m_scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.
454 HttpPort + "/assets/";
455
456 joinResponseMessage.BubbleName = m_scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName;
457
458 joinResponseMessage.BubbleRange = 128;
459 joinResponseMessage.BubblePerceptionRange = 128 + 256;
460 joinResponseMessage.BubbleRealTime = 0;
461 joinResponseMessage.ProgramName = m_programName;
462 joinResponseMessage.ProgramMajorVersion = m_programMajorVersion;
463 joinResponseMessage.ProgramMinorVersion = m_programMinorVersion;
464 joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
465 joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
466 joinResponseMessage.ProtocolSourceRevision = MxpConstants.ProtocolSourceRevision;
467
468 session.Send(joinResponseMessage);
469
470 session.SetStateConnected();
471 }
472
473 private void DeclineConnection(Session session, Message joinRequestMessage)
474 {
475 JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage));
476
477 joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId;
478 joinResponseMessage.FailureCode = MxpResponseCodes.UNAUTHORIZED_OPERATION;
479
480 joinResponseMessage.ProgramName = m_programName;
481 joinResponseMessage.ProgramMajorVersion = m_programMajorVersion;
482 joinResponseMessage.ProgramMinorVersion = m_programMinorVersion;
483 joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion;
484 joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion;
485 joinResponseMessage.ProtocolSourceRevision = MxpConstants.ProtocolSourceRevision;
486
487 session.Send(joinResponseMessage);
488
489 session.SetStateDisconnected();
490 }
491
492 public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account)
493 {
494 string firstName = "";
495 string lastName = "";
496 account = null;
497
498 string[] nameParts = participantName.Split(' ');
499 if (nameParts.Length != 2)
500 {
501 m_log.Error("[MXP ClientStack]: Login failed as user name is not formed of first and last name separated by space: " + participantName);
502 return false;
503 }
504 firstName = nameParts[0];
505 lastName = nameParts[1];
506
507 account = m_scenes[sceneId].UserAccountService.GetUserAccount(m_scenes[sceneId].RegionInfo.ScopeID, firstName, lastName);
508 if (account != null)
509 return (m_scenes[sceneId].AuthenticationService.Authenticate(account.PrincipalID, password, 1) != string.Empty);
510
511 return false;
512 }
513
514 private void AttachUserAgentToUserProfile(UserAccount account, Session session, UUID sessionId, UUID sceneId, out UUID secureSessionId)
515 {
516 secureSessionId = UUID.Random();
517 Scene scene = m_scenes[sceneId];
518 scene.PresenceService.LoginAgent(account.PrincipalID.ToString(), sessionId, secureSessionId);
519 }
520
521 private bool PrepareSceneForConnection(UUID sessionId, UUID secureSessionId, UUID sceneId, UserAccount account, out string reason)
522 {
523 Scene scene = m_scenes[sceneId];
524
525 AgentCircuitData agent = new AgentCircuitData();
526 agent.AgentID = account.PrincipalID;
527 agent.firstname = account.FirstName;
528 agent.lastname = account.LastName;
529 agent.SessionID = sessionId;
530 agent.SecureSessionID = secureSessionId;
531 agent.circuitcode = sessionId.CRC();
532 agent.BaseFolder = UUID.Zero;
533 agent.InventoryFolder = UUID.Zero;
534 agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position
535 agent.CapsPath = "http://localhost/";
536 agent.Appearance = scene.AvatarService.GetAppearance(account.PrincipalID);
537
538 if (agent.Appearance == null)
539 {
540 m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
541 agent.Appearance = new AvatarAppearance();
542 }
543
544 return scene.NewUserConnection(agent, 0, out reason);
545 }
546
547 public void PrintDebugInformation()
548 {
549 m_log.Info("[MXP ClientStack]: Statistics report");
550 m_log.Info("Pending Sessions: " + PendingSessionCount);
551 m_log.Info("Sessions: " + SessionCount + " (Clients: " + m_clients.Count + " )");
552 m_log.Info("Transmitter Alive?: " + IsTransmitterAlive);
553 m_log.Info("Packets Sent/Received: " + PacketsSent + " / " + PacketsReceived);
554 m_log.Info("Bytes Sent/Received: " + BytesSent + " / " + BytesReceived);
555 m_log.Info("Send/Receive Rate (bps): " + SendRate + " / " + ReceiveRate);
556 }
557
558 #endregion
559
560 }
561}
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
deleted file mode 100644
index d8cd0ac..0000000
--- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
+++ /dev/null
@@ -1,1231 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31using System.Drawing.Imaging;
32using System.IO;
33using System.Net;
34using System.Text;
35using OpenMetaverse;
36using OpenMetaverse.Imaging;
37using OpenMetaverse.Packets;
38using OpenSim.Framework;
39using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Region.Framework.Scenes;
42
43namespace OpenSim.Client.VWoHTTP.ClientStack
44{
45 class VWHClientView : IClientAPI
46 {
47 private Scene m_scene;
48
49
50 public bool ProcessInMsg(OSHttpRequest req, OSHttpResponse resp)
51 {
52 // 0 1 2 3
53 // http://simulator.com:9000/vwohttp/sessionid/methodname/param
54 string[] urlparts = req.Url.AbsolutePath.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
55
56 UUID sessionID;
57 // Check for session
58 if (!UUID.TryParse(urlparts[1], out sessionID))
59 return false;
60 // Check we match session
61 if (sessionID != SessionId)
62 return false;
63
64 string method = urlparts[2];
65
66 string param = String.Empty;
67 if (urlparts.Length > 3)
68 param = urlparts[3];
69
70 bool found;
71
72 switch (method.ToLower())
73 {
74 case "textures":
75 found = ProcessTextureRequest(param, resp);
76 break;
77 default:
78 found = false;
79 break;
80 }
81
82 return found;
83 }
84
85 private bool ProcessTextureRequest(string param, OSHttpResponse resp)
86 {
87 UUID assetID;
88 if (!UUID.TryParse(param, out assetID))
89 return false;
90
91 AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
92
93 if (asset == null)
94 return false;
95
96 ManagedImage tmp;
97 Image imgData;
98 byte[] jpegdata;
99
100 OpenJPEG.DecodeToImage(asset.Data, out tmp, out imgData);
101
102 using (MemoryStream ms = new MemoryStream())
103 {
104 imgData.Save(ms, ImageFormat.Jpeg);
105 jpegdata = ms.GetBuffer();
106 }
107
108 resp.ContentType = "image/jpeg";
109 resp.ContentLength = jpegdata.Length;
110 resp.StatusCode = 200;
111 resp.Body.Write(jpegdata, 0, jpegdata.Length);
112
113 return true;
114 }
115
116 public VWHClientView(UUID sessionID, UUID agentID, string agentName, Scene scene)
117 {
118 m_scene = scene;
119 }
120
121 #region Implementation of IClientAPI
122
123 public Vector3 StartPos
124 {
125 get { throw new System.NotImplementedException(); }
126 set { throw new System.NotImplementedException(); }
127 }
128
129 public UUID AgentId
130 {
131 get { throw new System.NotImplementedException(); }
132 }
133
134 public UUID SessionId
135 {
136 get { throw new System.NotImplementedException(); }
137 }
138
139 public UUID SecureSessionId
140 {
141 get { throw new System.NotImplementedException(); }
142 }
143
144 public UUID ActiveGroupId
145 {
146 get { throw new System.NotImplementedException(); }
147 }
148
149 public string ActiveGroupName
150 {
151 get { throw new System.NotImplementedException(); }
152 }
153
154 public ulong ActiveGroupPowers
155 {
156 get { throw new System.NotImplementedException(); }
157 }
158
159 public ulong GetGroupPowers(UUID groupID)
160 {
161 throw new System.NotImplementedException();
162 }
163
164 public bool IsGroupMember(UUID GroupID)
165 {
166 throw new System.NotImplementedException();
167 }
168
169 public string FirstName
170 {
171 get { throw new System.NotImplementedException(); }
172 }
173
174 public string LastName
175 {
176 get { throw new System.NotImplementedException(); }
177 }
178
179 public IScene Scene
180 {
181 get { throw new System.NotImplementedException(); }
182 }
183
184 public int NextAnimationSequenceNumber
185 {
186 get { throw new System.NotImplementedException(); }
187 }
188
189 public string Name
190 {
191 get { throw new System.NotImplementedException(); }
192 }
193
194 public bool IsActive
195 {
196 get { throw new System.NotImplementedException(); }
197 set { throw new System.NotImplementedException(); }
198 }
199 public bool IsLoggingOut
200 {
201 get { throw new System.NotImplementedException(); }
202 set { throw new System.NotImplementedException(); }
203 }
204 public bool SendLogoutPacketWhenClosing
205 {
206 set { throw new System.NotImplementedException(); }
207 }
208
209 public uint CircuitCode
210 {
211 get { throw new System.NotImplementedException(); }
212 }
213
214 public IPEndPoint RemoteEndPoint
215 {
216 get { throw new System.NotImplementedException(); }
217 }
218
219 public event GenericMessage OnGenericMessage = delegate { };
220 public event ImprovedInstantMessage OnInstantMessage = delegate { };
221 public event ChatMessage OnChatFromClient = delegate { };
222 public event TextureRequest OnRequestTexture = delegate { };
223 public event RezObject OnRezObject = delegate { };
224 public event ModifyTerrain OnModifyTerrain = delegate { };
225 public event BakeTerrain OnBakeTerrain = delegate { };
226 public event EstateChangeInfo OnEstateChangeInfo = delegate { };
227 public event SetAppearance OnSetAppearance = delegate { };
228 public event AvatarNowWearing OnAvatarNowWearing = delegate { };
229 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv = delegate { return new UUID(); };
230 public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv = delegate { };
231 public event UUIDNameRequest OnDetachAttachmentIntoInv = delegate { };
232 public event ObjectAttach OnObjectAttach = delegate { };
233 public event ObjectDeselect OnObjectDetach = delegate { };
234 public event ObjectDrop OnObjectDrop = delegate { };
235 public event StartAnim OnStartAnim = delegate { };
236 public event StopAnim OnStopAnim = delegate { };
237 public event LinkObjects OnLinkObjects = delegate { };
238 public event DelinkObjects OnDelinkObjects = delegate { };
239 public event RequestMapBlocks OnRequestMapBlocks = delegate { };
240 public event RequestMapName OnMapNameRequest = delegate { };
241 public event TeleportLocationRequest OnTeleportLocationRequest = delegate { };
242 public event DisconnectUser OnDisconnectUser = delegate { };
243 public event RequestAvatarProperties OnRequestAvatarProperties = delegate { };
244 public event SetAlwaysRun OnSetAlwaysRun = delegate { };
245 public event TeleportLandmarkRequest OnTeleportLandmarkRequest = delegate { };
246 public event DeRezObject OnDeRezObject = delegate { };
247 public event Action<IClientAPI> OnRegionHandShakeReply = delegate { };
248 public event GenericCall1 OnRequestWearables = delegate { };
249 public event GenericCall1 OnCompleteMovementToRegion = delegate { };
250 public event UpdateAgent OnPreAgentUpdate;
251 public event UpdateAgent OnAgentUpdate = delegate { };
252 public event AgentRequestSit OnAgentRequestSit = delegate { };
253 public event AgentSit OnAgentSit = delegate { };
254 public event AvatarPickerRequest OnAvatarPickerRequest = delegate { };
255 public event Action<IClientAPI> OnRequestAvatarsData = delegate { };
256 public event AddNewPrim OnAddPrim = delegate { };
257 public event FetchInventory OnAgentDataUpdateRequest = delegate { };
258 public event TeleportLocationRequest OnSetStartLocationRequest = delegate { };
259 public event RequestGodlikePowers OnRequestGodlikePowers = delegate { };
260 public event GodKickUser OnGodKickUser = delegate { };
261 public event ObjectDuplicate OnObjectDuplicate = delegate { };
262 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay = delegate { };
263 public event GrabObject OnGrabObject = delegate { };
264 public event DeGrabObject OnDeGrabObject = delegate { };
265 public event MoveObject OnGrabUpdate = delegate { };
266 public event SpinStart OnSpinStart = delegate { };
267 public event SpinObject OnSpinUpdate = delegate { };
268 public event SpinStop OnSpinStop = delegate { };
269 public event UpdateShape OnUpdatePrimShape = delegate { };
270 public event ObjectExtraParams OnUpdateExtraParams = delegate { };
271 public event ObjectRequest OnObjectRequest = delegate { };
272 public event ObjectSelect OnObjectSelect = delegate { };
273 public event ObjectDeselect OnObjectDeselect = delegate { };
274 public event GenericCall7 OnObjectDescription = delegate { };
275 public event GenericCall7 OnObjectName = delegate { };
276 public event GenericCall7 OnObjectClickAction = delegate { };
277 public event GenericCall7 OnObjectMaterial = delegate { };
278 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily = delegate { };
279 public event UpdatePrimFlags OnUpdatePrimFlags = delegate { };
280 public event UpdatePrimTexture OnUpdatePrimTexture = delegate { };
281 public event UpdateVector OnUpdatePrimGroupPosition = delegate { };
282 public event UpdateVector OnUpdatePrimSinglePosition = delegate { };
283 public event UpdatePrimRotation OnUpdatePrimGroupRotation = delegate { };
284 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation = delegate { };
285 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition = delegate { };
286 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation = delegate { };
287 public event UpdateVector OnUpdatePrimScale = delegate { };
288 public event UpdateVector OnUpdatePrimGroupScale = delegate { };
289 public event StatusChange OnChildAgentStatus = delegate { };
290 public event GenericCall2 OnStopMovement = delegate { };
291 public event Action<UUID> OnRemoveAvatar = delegate { };
292 public event ObjectPermissions OnObjectPermissions = delegate { };
293 public event CreateNewInventoryItem OnCreateNewInventoryItem = delegate { };
294 public event LinkInventoryItem OnLinkInventoryItem = delegate { };
295 public event CreateInventoryFolder OnCreateNewInventoryFolder = delegate { };
296 public event UpdateInventoryFolder OnUpdateInventoryFolder = delegate { };
297 public event MoveInventoryFolder OnMoveInventoryFolder = delegate { };
298 public event FetchInventoryDescendents OnFetchInventoryDescendents = delegate { };
299 public event PurgeInventoryDescendents OnPurgeInventoryDescendents = delegate { };
300 public event FetchInventory OnFetchInventory = delegate { };
301 public event RequestTaskInventory OnRequestTaskInventory = delegate { };
302 public event UpdateInventoryItem OnUpdateInventoryItem = delegate { };
303 public event CopyInventoryItem OnCopyInventoryItem = delegate { };
304 public event MoveInventoryItem OnMoveInventoryItem = delegate { };
305 public event RemoveInventoryFolder OnRemoveInventoryFolder = delegate { };
306 public event RemoveInventoryItem OnRemoveInventoryItem = delegate { };
307 public event UDPAssetUploadRequest OnAssetUploadRequest = delegate { };
308 public event XferReceive OnXferReceive = delegate { };
309 public event RequestXfer OnRequestXfer = delegate { };
310 public event ConfirmXfer OnConfirmXfer = delegate { };
311 public event AbortXfer OnAbortXfer = delegate { };
312 public event RezScript OnRezScript = delegate { };
313 public event UpdateTaskInventory OnUpdateTaskInventory = delegate { };
314 public event MoveTaskInventory OnMoveTaskItem = delegate { };
315 public event RemoveTaskInventory OnRemoveTaskItem = delegate { };
316 public event RequestAsset OnRequestAsset = delegate { };
317 public event UUIDNameRequest OnNameFromUUIDRequest = delegate { };
318 public event ParcelAccessListRequest OnParcelAccessListRequest = delegate { };
319 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest = delegate { };
320 public event ParcelPropertiesRequest OnParcelPropertiesRequest = delegate { };
321 public event ParcelDivideRequest OnParcelDivideRequest = delegate { };
322 public event ParcelJoinRequest OnParcelJoinRequest = delegate { };
323 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest = delegate { };
324 public event ParcelSelectObjects OnParcelSelectObjects = delegate { };
325 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest = delegate { };
326 public event ParcelAbandonRequest OnParcelAbandonRequest = delegate { };
327 public event ParcelGodForceOwner OnParcelGodForceOwner = delegate { };
328 public event ParcelReclaim OnParcelReclaim = delegate { };
329 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest = delegate { };
330 public event ParcelDeedToGroup OnParcelDeedToGroup = delegate { };
331 public event RegionInfoRequest OnRegionInfoRequest = delegate { };
332 public event EstateCovenantRequest OnEstateCovenantRequest = delegate { };
333 public event FriendActionDelegate OnApproveFriendRequest = delegate { };
334 public event FriendActionDelegate OnDenyFriendRequest = delegate { };
335 public event FriendshipTermination OnTerminateFriendship = delegate { };
336 public event GrantUserFriendRights OnGrantUserRights = delegate { };
337 public event MoneyTransferRequest OnMoneyTransferRequest = delegate { };
338 public event EconomyDataRequest OnEconomyDataRequest = delegate { };
339 public event MoneyBalanceRequest OnMoneyBalanceRequest = delegate { };
340 public event UpdateAvatarProperties OnUpdateAvatarProperties = delegate { };
341 public event ParcelBuy OnParcelBuy = delegate { };
342 public event RequestPayPrice OnRequestPayPrice = delegate { };
343 public event ObjectSaleInfo OnObjectSaleInfo = delegate { };
344 public event ObjectBuy OnObjectBuy = delegate { };
345 public event BuyObjectInventory OnBuyObjectInventory = delegate { };
346 public event RequestTerrain OnRequestTerrain = delegate { };
347 public event RequestTerrain OnUploadTerrain = delegate { };
348 public event ObjectIncludeInSearch OnObjectIncludeInSearch = delegate { };
349 public event UUIDNameRequest OnTeleportHomeRequest = delegate { };
350 public event ScriptAnswer OnScriptAnswer = delegate { };
351 public event AgentSit OnUndo = delegate { };
352 public event AgentSit OnRedo = delegate { };
353 public event LandUndo OnLandUndo = delegate { };
354 public event ForceReleaseControls OnForceReleaseControls = delegate { };
355 public event GodLandStatRequest OnLandStatRequest = delegate { };
356 public event DetailedEstateDataRequest OnDetailedEstateDataRequest = delegate { };
357 public event SetEstateFlagsRequest OnSetEstateFlagsRequest = delegate { };
358 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture = delegate { };
359 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture = delegate { };
360 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights = delegate { };
361 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest = delegate { };
362 public event SetRegionTerrainSettings OnSetRegionTerrainSettings = delegate { };
363 public event EstateRestartSimRequest OnEstateRestartSimRequest = delegate { };
364 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest = delegate { };
365 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest = delegate { };
366 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest = delegate { };
367 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest = delegate { };
368 public event EstateDebugRegionRequest OnEstateDebugRegionRequest = delegate { };
369 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest = delegate { };
370 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest = delegate { };
371 public event UUIDNameRequest OnUUIDGroupNameRequest = delegate { };
372 public event RegionHandleRequest OnRegionHandleRequest = delegate { };
373 public event ParcelInfoRequest OnParcelInfoRequest = delegate { };
374 public event RequestObjectPropertiesFamily OnObjectGroupRequest = delegate { };
375 public event ScriptReset OnScriptReset = delegate { };
376 public event GetScriptRunning OnGetScriptRunning = delegate { };
377 public event SetScriptRunning OnSetScriptRunning = delegate { };
378 public event UpdateVector OnAutoPilotGo = delegate { };
379 public event TerrainUnacked OnUnackedTerrain = delegate { };
380 public event ActivateGesture OnActivateGesture = delegate { };
381 public event DeactivateGesture OnDeactivateGesture = delegate { };
382 public event ObjectOwner OnObjectOwner = delegate { };
383 public event DirPlacesQuery OnDirPlacesQuery = delegate { };
384 public event DirFindQuery OnDirFindQuery = delegate { };
385 public event DirLandQuery OnDirLandQuery = delegate { };
386 public event DirPopularQuery OnDirPopularQuery = delegate { };
387 public event DirClassifiedQuery OnDirClassifiedQuery = delegate { };
388 public event EventInfoRequest OnEventInfoRequest = delegate { };
389 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime = delegate { };
390 public event MapItemRequest OnMapItemRequest = delegate { };
391 public event OfferCallingCard OnOfferCallingCard = delegate { };
392 public event AcceptCallingCard OnAcceptCallingCard = delegate { };
393 public event DeclineCallingCard OnDeclineCallingCard = delegate { };
394 public event SoundTrigger OnSoundTrigger = delegate { };
395 public event StartLure OnStartLure = delegate { };
396 public event TeleportLureRequest OnTeleportLureRequest = delegate { };
397 public event NetworkStats OnNetworkStatsUpdate = delegate { };
398 public event ClassifiedInfoRequest OnClassifiedInfoRequest = delegate { };
399 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate = delegate { };
400 public event ClassifiedDelete OnClassifiedDelete = delegate { };
401 public event ClassifiedDelete OnClassifiedGodDelete = delegate { };
402 public event EventNotificationAddRequest OnEventNotificationAddRequest = delegate { };
403 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest = delegate { };
404 public event EventGodDelete OnEventGodDelete = delegate { };
405 public event ParcelDwellRequest OnParcelDwellRequest = delegate { };
406 public event UserInfoRequest OnUserInfoRequest = delegate { };
407 public event UpdateUserInfo OnUpdateUserInfo = delegate { };
408 public event RetrieveInstantMessages OnRetrieveInstantMessages = delegate { };
409 public event PickDelete OnPickDelete = delegate { };
410 public event PickGodDelete OnPickGodDelete = delegate { };
411 public event PickInfoUpdate OnPickInfoUpdate = delegate { };
412 public event AvatarNotesUpdate OnAvatarNotesUpdate = delegate { };
413 public event MuteListRequest OnMuteListRequest = delegate { };
414 public event AvatarInterestUpdate OnAvatarInterestUpdate = delegate { };
415 public event PlacesQuery OnPlacesQuery = delegate { };
416 public event FindAgentUpdate OnFindAgent = delegate { };
417 public event TrackAgentUpdate OnTrackAgent = delegate { };
418 public event NewUserReport OnUserReport = delegate { };
419 public event SaveStateHandler OnSaveState = delegate { };
420 public event GroupAccountSummaryRequest OnGroupAccountSummaryRequest = delegate { };
421 public event GroupAccountDetailsRequest OnGroupAccountDetailsRequest = delegate { };
422 public event GroupAccountTransactionsRequest OnGroupAccountTransactionsRequest = delegate { };
423 public event FreezeUserUpdate OnParcelFreezeUser = delegate { };
424 public event EjectUserUpdate OnParcelEjectUser = delegate { };
425 public event ParcelBuyPass OnParcelBuyPass = delegate { };
426 public event ParcelGodMark OnParcelGodMark = delegate { };
427 public event GroupActiveProposalsRequest OnGroupActiveProposalsRequest = delegate { };
428 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest = delegate { };
429 public event SimWideDeletesDelegate OnSimWideDeletes = delegate { };
430 public event SendPostcard OnSendPostcard = delegate { };
431 public event MuteListEntryUpdate OnUpdateMuteListEntry = delegate { };
432 public event MuteListEntryRemove OnRemoveMuteListEntry = delegate { };
433 public event GodlikeMessage onGodlikeMessage = delegate { };
434 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate = delegate { };
435
436
437
438 public void SetDebugPacketLevel(int newDebug)
439 {
440 throw new System.NotImplementedException();
441 }
442
443 public void InPacket(object NewPack)
444 {
445 throw new System.NotImplementedException();
446 }
447
448 public void ProcessInPacket(Packet NewPack)
449 {
450 throw new System.NotImplementedException();
451 }
452
453 public void Close()
454 {
455 throw new System.NotImplementedException();
456 }
457
458 public void Kick(string message)
459 {
460 throw new System.NotImplementedException();
461 }
462
463 public void Start()
464 {
465 throw new System.NotImplementedException();
466 }
467
468 public void Stop()
469 {
470 throw new System.NotImplementedException();
471 }
472
473 public void SendWearables(AvatarWearable[] wearables, int serial)
474 {
475 throw new System.NotImplementedException();
476 }
477
478 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
479 {
480 throw new System.NotImplementedException();
481 }
482
483 public void SendStartPingCheck(byte seq)
484 {
485 throw new System.NotImplementedException();
486 }
487
488 public void SendKillObject(ulong regionHandle, uint localID)
489 {
490 throw new System.NotImplementedException();
491 }
492
493 public void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
494 {
495 throw new System.NotImplementedException();
496 }
497
498 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
499 {
500 throw new System.NotImplementedException();
501 }
502
503 public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, byte audible)
504 {
505 throw new System.NotImplementedException();
506 }
507
508 public void SendInstantMessage(GridInstantMessage im)
509 {
510 throw new System.NotImplementedException();
511 }
512
513 public void SendGenericMessage(string method, List<string> message)
514 {
515 }
516
517 public void SendGenericMessage(string method, List<byte[]> message)
518 {
519 throw new System.NotImplementedException();
520 }
521
522 public void SendLayerData(float[] map)
523 {
524 throw new System.NotImplementedException();
525 }
526
527 public void SendLayerData(int px, int py, float[] map)
528 {
529 throw new System.NotImplementedException();
530 }
531
532 public void SendWindData(Vector2[] windSpeeds)
533 {
534 throw new System.NotImplementedException();
535 }
536
537 public void SendCloudData(float[] cloudCover)
538 {
539 throw new System.NotImplementedException();
540 }
541
542 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
543 {
544 throw new System.NotImplementedException();
545 }
546
547 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
548 {
549 throw new System.NotImplementedException();
550 }
551
552 public AgentCircuitData RequestClientInfo()
553 {
554 throw new System.NotImplementedException();
555 }
556
557 public void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL)
558 {
559 throw new System.NotImplementedException();
560 }
561
562 public void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
563 {
564 throw new System.NotImplementedException();
565 }
566
567 public void SendLocalTeleport(Vector3 position, Vector3 lookAt, uint flags)
568 {
569 throw new System.NotImplementedException();
570 }
571
572 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL)
573 {
574 throw new System.NotImplementedException();
575 }
576
577 public void SendTeleportFailed(string reason)
578 {
579 throw new System.NotImplementedException();
580 }
581
582 public void SendTeleportStart(uint flags)
583 {
584 throw new System.NotImplementedException();
585 }
586
587 public void SendTeleportProgress(uint flags, string message)
588 {
589 throw new System.NotImplementedException();
590 }
591
592 public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
593 {
594 throw new System.NotImplementedException();
595 }
596
597 public void SendPayPrice(UUID objectID, int[] payPrice)
598 {
599 throw new System.NotImplementedException();
600 }
601
602 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
603 {
604 throw new System.NotImplementedException();
605 }
606
607 public void SetChildAgentThrottle(byte[] throttle)
608 {
609 throw new System.NotImplementedException();
610 }
611
612 public void SendAvatarDataImmediate(ISceneEntity avatar)
613 {
614 throw new System.NotImplementedException();
615 }
616
617 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
618 {
619 throw new System.NotImplementedException();
620 }
621
622 public void ReprioritizeUpdates()
623 {
624 throw new System.NotImplementedException();
625 }
626
627 public void FlushPrimUpdates()
628 {
629 throw new System.NotImplementedException();
630 }
631
632 public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int version, bool fetchFolders, bool fetchItems)
633 {
634 throw new System.NotImplementedException();
635 }
636
637 public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
638 {
639 throw new System.NotImplementedException();
640 }
641
642 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
643 {
644 throw new System.NotImplementedException();
645 }
646
647 public void SendRemoveInventoryItem(UUID itemID)
648 {
649 throw new System.NotImplementedException();
650 }
651
652 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
653 {
654 throw new System.NotImplementedException();
655 }
656
657 public void SendTaskInventory(UUID taskID, short serial, byte[] fileName)
658 {
659 throw new System.NotImplementedException();
660 }
661
662 public void SendBulkUpdateInventory(InventoryNodeBase node)
663 {
664 throw new System.NotImplementedException();
665 }
666
667 public void SendXferPacket(ulong xferID, uint packet, byte[] data)
668 {
669 throw new System.NotImplementedException();
670 }
671
672 public virtual void SendAbortXferPacket(ulong xferID)
673 {
674 throw new System.NotImplementedException();
675 }
676
677 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
678 {
679 throw new System.NotImplementedException();
680 }
681
682 public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
683 {
684 throw new System.NotImplementedException();
685 }
686
687 public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
688 {
689 throw new System.NotImplementedException();
690 }
691
692 public void SendPreLoadSound(UUID objectID, UUID ownerID, UUID soundID)
693 {
694 throw new System.NotImplementedException();
695 }
696
697 public void SendPlayAttachedSound(UUID soundID, UUID objectID, UUID ownerID, float gain, byte flags)
698 {
699 throw new System.NotImplementedException();
700 }
701
702 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
703 {
704 throw new System.NotImplementedException();
705 }
706
707 public void SendAttachedSoundGainChange(UUID objectID, float gain)
708 {
709 throw new System.NotImplementedException();
710 }
711
712 public void SendNameReply(UUID profileId, string firstname, string lastname)
713 {
714 throw new System.NotImplementedException();
715 }
716
717 public void SendAlertMessage(string message)
718 {
719 throw new System.NotImplementedException();
720 }
721
722 public void SendAgentAlertMessage(string message, bool modal)
723 {
724 throw new System.NotImplementedException();
725 }
726
727 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
728 {
729 throw new System.NotImplementedException();
730 }
731
732 public void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
733 {
734 throw new System.NotImplementedException();
735 }
736
737 public bool AddMoney(int debit)
738 {
739 throw new System.NotImplementedException();
740 }
741
742 public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition)
743 {
744 throw new System.NotImplementedException();
745 }
746
747 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
748 {
749 throw new System.NotImplementedException();
750 }
751
752 public void SendViewerTime(int phase)
753 {
754 throw new System.NotImplementedException();
755 }
756
757 public UUID GetDefaultAnimation(string name)
758 {
759 throw new System.NotImplementedException();
760 }
761
762 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
763 {
764 throw new System.NotImplementedException();
765 }
766
767 public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
768 {
769 throw new System.NotImplementedException();
770 }
771
772 public void SendHealth(float health)
773 {
774 throw new System.NotImplementedException();
775 }
776
777 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
778 {
779 throw new System.NotImplementedException();
780 }
781
782 public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
783 {
784 throw new System.NotImplementedException();
785 }
786
787 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
788 {
789 throw new System.NotImplementedException();
790 }
791
792 public void SendEstateCovenantInformation(UUID covenant)
793 {
794 throw new System.NotImplementedException();
795 }
796
797 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
798 {
799 throw new System.NotImplementedException();
800 }
801
802 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
803 {
804 throw new System.NotImplementedException();
805 }
806
807 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
808 {
809 throw new System.NotImplementedException();
810 }
811
812 public void SendForceClientSelectObjects(List<uint> objectIDs)
813 {
814 throw new System.NotImplementedException();
815 }
816
817 public void SendCameraConstraint(Vector4 ConstraintPlane)
818 {
819
820 }
821
822 public void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount)
823 {
824 throw new System.NotImplementedException();
825 }
826
827 public void SendLandParcelOverlay(byte[] data, int sequence_id)
828 {
829 throw new System.NotImplementedException();
830 }
831
832 public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
833 {
834 throw new System.NotImplementedException();
835 }
836
837 public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, byte autoScale, string mediaType, string mediaDesc, int mediaWidth, int mediaHeight, byte mediaLoop)
838 {
839 throw new System.NotImplementedException();
840 }
841
842 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
843 {
844 throw new System.NotImplementedException();
845 }
846
847 public void SendConfirmXfer(ulong xferID, uint PacketID)
848 {
849 throw new System.NotImplementedException();
850 }
851
852 public void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName)
853 {
854 throw new System.NotImplementedException();
855 }
856
857 public void SendInitiateDownload(string simFileName, string clientFileName)
858 {
859 throw new System.NotImplementedException();
860 }
861
862 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
863 {
864 throw new System.NotImplementedException();
865 }
866
867 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
868 {
869 throw new System.NotImplementedException();
870 }
871
872 public void SendImageNotFound(UUID imageid)
873 {
874 throw new System.NotImplementedException();
875 }
876
877 public void SendShutdownConnectionNotice()
878 {
879 throw new System.NotImplementedException();
880 }
881
882 public void SendSimStats(SimStats stats)
883 {
884 throw new System.NotImplementedException();
885 }
886
887 public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
888 {
889 throw new System.NotImplementedException();
890 }
891
892 public void SendObjectPropertiesReply(ISceneEntity entity)
893 {
894 throw new System.NotImplementedException();
895 }
896
897 public void SendAgentOffline(UUID[] agentIDs)
898 {
899 throw new System.NotImplementedException();
900 }
901
902 public void SendAgentOnline(UUID[] agentIDs)
903 {
904 throw new System.NotImplementedException();
905 }
906
907 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot, Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
908 {
909 throw new System.NotImplementedException();
910 }
911
912 public void SendAdminResponse(UUID Token, uint AdminLevel)
913 {
914 throw new System.NotImplementedException();
915 }
916
917 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
918 {
919 throw new System.NotImplementedException();
920 }
921
922 public void SendGroupNameReply(UUID groupLLUID, string GroupName)
923 {
924 throw new System.NotImplementedException();
925 }
926
927 public void SendJoinGroupReply(UUID groupID, bool success)
928 {
929 throw new System.NotImplementedException();
930 }
931
932 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
933 {
934 throw new System.NotImplementedException();
935 }
936
937 public void SendLeaveGroupReply(UUID groupID, bool success)
938 {
939 throw new System.NotImplementedException();
940 }
941
942 public void SendCreateGroupReply(UUID groupID, bool success, string message)
943 {
944 throw new System.NotImplementedException();
945 }
946
947 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
948 {
949 throw new System.NotImplementedException();
950 }
951
952 public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
953 {
954 throw new System.NotImplementedException();
955 }
956
957 public void SendAsset(AssetRequestToClient req)
958 {
959 throw new System.NotImplementedException();
960 }
961
962 public void SendTexture(AssetBase TextureAsset)
963 {
964 throw new System.NotImplementedException();
965 }
966
967 public byte[] GetThrottlesPacked(float multiplier)
968 {
969 throw new System.NotImplementedException();
970 }
971
972 public event ViewerEffectEventHandler OnViewerEffect;
973 public event Action<IClientAPI> OnLogout;
974 public event Action<IClientAPI> OnConnectionClosed;
975 public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message)
976 {
977 throw new System.NotImplementedException();
978 }
979
980 public void SendLogoutPacket()
981 {
982 throw new System.NotImplementedException();
983 }
984
985 public EndPoint GetClientEP()
986 {
987 return null;
988 }
989
990 public ClientInfo GetClientInfo()
991 {
992 throw new System.NotImplementedException();
993 }
994
995 public void SetClientInfo(ClientInfo info)
996 {
997 throw new System.NotImplementedException();
998 }
999
1000 public void SetClientOption(string option, string value)
1001 {
1002 throw new System.NotImplementedException();
1003 }
1004
1005 public string GetClientOption(string option)
1006 {
1007 throw new System.NotImplementedException();
1008 }
1009
1010 public void Terminate()
1011 {
1012 throw new System.NotImplementedException();
1013 }
1014
1015 public void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters)
1016 {
1017 throw new System.NotImplementedException();
1018 }
1019
1020 public void SendClearFollowCamProperties(UUID objectID)
1021 {
1022 throw new System.NotImplementedException();
1023 }
1024
1025 public void SendRegionHandle(UUID regoinID, ulong handle)
1026 {
1027 throw new System.NotImplementedException();
1028 }
1029
1030 public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
1031 {
1032 throw new System.NotImplementedException();
1033 }
1034
1035 public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
1036 {
1037 throw new System.NotImplementedException();
1038 }
1039
1040 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
1041 {
1042 throw new System.NotImplementedException();
1043 }
1044
1045 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
1046 {
1047 throw new System.NotImplementedException();
1048 }
1049
1050 public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
1051 {
1052 throw new System.NotImplementedException();
1053 }
1054
1055 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
1056 {
1057 throw new System.NotImplementedException();
1058 }
1059
1060 public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
1061 {
1062 throw new System.NotImplementedException();
1063 }
1064
1065 public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
1066 {
1067 throw new System.NotImplementedException();
1068 }
1069
1070 public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
1071 {
1072 throw new System.NotImplementedException();
1073 }
1074
1075 public void SendEventInfoReply(EventData info)
1076 {
1077 throw new System.NotImplementedException();
1078 }
1079
1080 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
1081 {
1082 throw new System.NotImplementedException();
1083 }
1084
1085 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
1086 {
1087 throw new System.NotImplementedException();
1088 }
1089
1090 public void SendOfferCallingCard(UUID srcID, UUID transactionID)
1091 {
1092 throw new System.NotImplementedException();
1093 }
1094
1095 public void SendAcceptCallingCard(UUID transactionID)
1096 {
1097 throw new System.NotImplementedException();
1098 }
1099
1100 public void SendDeclineCallingCard(UUID transactionID)
1101 {
1102 throw new System.NotImplementedException();
1103 }
1104
1105 public void SendTerminateFriend(UUID exFriendID)
1106 {
1107 throw new System.NotImplementedException();
1108 }
1109
1110 public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
1111 {
1112 throw new System.NotImplementedException();
1113 }
1114
1115 public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
1116 {
1117 throw new System.NotImplementedException();
1118 }
1119
1120 public void SendAgentDropGroup(UUID groupID)
1121 {
1122 throw new System.NotImplementedException();
1123 }
1124
1125 public void RefreshGroupMembership()
1126 {
1127 throw new System.NotImplementedException();
1128 }
1129
1130 public void SendAvatarNotesReply(UUID targetID, string text)
1131 {
1132 throw new System.NotImplementedException();
1133 }
1134
1135 public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
1136 {
1137 throw new System.NotImplementedException();
1138 }
1139
1140 public void SendPickInfoReply(UUID pickID, UUID creatorID, bool topPick, UUID parcelID, string name, string desc, UUID snapshotID, string user, string originalName, string simName, Vector3 posGlobal, int sortOrder, bool enabled)
1141 {
1142 throw new System.NotImplementedException();
1143 }
1144
1145 public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
1146 {
1147 throw new System.NotImplementedException();
1148 }
1149
1150 public void SendAvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages)
1151 {
1152 throw new System.NotImplementedException();
1153 }
1154
1155 public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
1156 {
1157 throw new System.NotImplementedException();
1158 }
1159
1160 public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
1161 {
1162 throw new System.NotImplementedException();
1163 }
1164
1165 public void SendUseCachedMuteList()
1166 {
1167 throw new System.NotImplementedException();
1168 }
1169
1170 public void SendMuteListUpdate(string filename)
1171 {
1172 throw new System.NotImplementedException();
1173 }
1174
1175 public void KillEndDone()
1176 {
1177 throw new System.NotImplementedException();
1178 }
1179
1180 public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
1181 {
1182 throw new System.NotImplementedException();
1183 }
1184
1185 #endregion
1186
1187 public void SendRebakeAvatarTextures(UUID textureID)
1188 {
1189 }
1190
1191 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)
1192 {
1193 }
1194
1195 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1196 {
1197 }
1198
1199 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1200 {
1201 }
1202
1203 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt)
1204 {
1205 }
1206
1207 public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
1208 {
1209 }
1210
1211 public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals)
1212 {
1213 }
1214
1215 public void SendChangeUserRights(UUID agentID, UUID friendID, int rights)
1216 {
1217 }
1218
1219 public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId)
1220 {
1221 }
1222
1223 public void StopFlying(ISceneEntity presence)
1224 {
1225 }
1226
1227 public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
1228 {
1229 }
1230 }
1231}
diff --git a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs b/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
deleted file mode 100644
index 31385ba..0000000
--- a/OpenSim/Client/VWoHTTP/VWoHTTPModule.cs
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27using System;
28using System.Collections.Generic;
29using System.Text;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Client.VWoHTTP.ClientStack;
33using OpenSim.Framework;
34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38
39namespace OpenSim.Client.VWoHTTP
40{
41 class VWoHTTPModule : IRegionModule, IHttpAgentHandler
42 {
43 private bool m_disabled = true;
44
45 private IHttpServer m_httpd;
46
47 private readonly List<Scene> m_scenes = new List<Scene>();
48
49 private Dictionary<UUID, VWHClientView> m_clients = new Dictionary<UUID, VWHClientView>();
50
51 #region Implementation of IRegionModule
52
53 public void Initialise(Scene scene, IConfigSource source)
54 {
55 if (m_disabled)
56 return;
57
58 m_scenes.Add(scene);
59
60 m_httpd = MainServer.Instance;
61 }
62
63 public void PostInitialise()
64 {
65 if (m_disabled)
66 return;
67
68 m_httpd.AddAgentHandler("vwohttp", this);
69 }
70
71 public void Close()
72 {
73 if (m_disabled)
74 return;
75
76 m_httpd.RemoveAgentHandler("vwohttp", this);
77 }
78
79 public string Name
80 {
81 get { return "VWoHTTP ClientStack"; }
82 }
83
84 public bool IsSharedModule
85 {
86 get { return true; }
87 }
88
89 #endregion
90
91 #region Implementation of IHttpAgentHandler
92
93 public bool Handle(OSHttpRequest req, OSHttpResponse resp)
94 {
95 string[] urlparts = req.Url.AbsolutePath.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
96
97 if (urlparts.Length < 2)
98 return false;
99
100 if (urlparts[1] == "connect")
101 {
102 UUID sessID = UUID.Random();
103
104 VWHClientView client = new VWHClientView(sessID, UUID.Random(), "VWoHTTPClient", m_scenes[0]);
105
106 m_clients.Add(sessID, client);
107
108 return true;
109 }
110 else
111 {
112 if (urlparts.Length < 3)
113 return false;
114
115 UUID sessionID;
116 if (!UUID.TryParse(urlparts[1], out sessionID))
117 return false;
118
119 if (!m_clients.ContainsKey(sessionID))
120 return false;
121
122 return m_clients[sessionID].ProcessInMsg(req, resp);
123 }
124 }
125
126 public bool Match(OSHttpRequest req, OSHttpResponse resp)
127 {
128 return req.Url.ToString().Contains("vwohttp");
129 }
130
131 #endregion
132 }
133}
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
index 6a5d6eb..f5492b3 100644
--- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
@@ -56,15 +56,15 @@ namespace OpenSim.Data.MSSQL
56 string realm, string storeName) 56 string realm, string storeName)
57 { 57 {
58 m_Realm = realm; 58 m_Realm = realm;
59
60 m_ConnectionString = connectionString;
59 61
60 if (storeName != String.Empty) 62 if (storeName != String.Empty)
61 { 63 {
62 Assembly assem = GetType().Assembly;
63 m_ConnectionString = connectionString;
64 using (SqlConnection conn = new SqlConnection(m_ConnectionString)) 64 using (SqlConnection conn = new SqlConnection(m_ConnectionString))
65 { 65 {
66 conn.Open(); 66 conn.Open();
67 Migration m = new Migration(conn, assem, storeName); 67 Migration m = new Migration(conn, GetType().Assembly, storeName);
68 m.Update(); 68 m.Update();
69 } 69 }
70 70
diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs
index aea31c9..cd395b8 100644
--- a/OpenSim/Data/MSSQL/MSSQLMigration.cs
+++ b/OpenSim/Data/MSSQL/MSSQLMigration.cs
@@ -61,7 +61,8 @@ namespace OpenSim.Data.MSSQL
61 } 61 }
62 catch 62 catch
63 { 63 {
64 // Something went wrong, so we're version 0 64 // Return -1 to indicate table does not exist
65 return -1;
65 } 66 }
66 } 67 }
67 return version; 68 return version;
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index 80ec65e..5155e56 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -492,12 +492,11 @@ ELSE
492 using (SqlConnection conn = new SqlConnection(m_connectionString)) 492 using (SqlConnection conn = new SqlConnection(m_connectionString))
493 using (SqlCommand cmd = new SqlCommand(sql, conn)) 493 using (SqlCommand cmd = new SqlCommand(sql, conn))
494 { 494 {
495 conn.Open();
495 foreach (TaskInventoryItem taskItem in items) 496 foreach (TaskInventoryItem taskItem in items)
496 { 497 {
497 cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); 498 cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem));
498 conn.Open();
499 cmd.ExecuteNonQuery(); 499 cmd.ExecuteNonQuery();
500
501 cmd.Parameters.Clear(); 500 cmd.Parameters.Clear();
502 } 501 }
503 } 502 }
@@ -1154,9 +1153,9 @@ VALUES
1154 PrimitiveBaseShape baseShape = new PrimitiveBaseShape(); 1153 PrimitiveBaseShape baseShape = new PrimitiveBaseShape();
1155 1154
1156 baseShape.Scale = new Vector3( 1155 baseShape.Scale = new Vector3(
1157 Convert.ToSingle(shapeRow["ScaleX"]), 1156 (float)Convert.ToDouble(shapeRow["ScaleX"]),
1158 Convert.ToSingle(shapeRow["ScaleY"]), 1157 (float)Convert.ToDouble(shapeRow["ScaleY"]),
1159 Convert.ToSingle(shapeRow["ScaleZ"])); 1158 (float)Convert.ToDouble(shapeRow["ScaleZ"]));
1160 1159
1161 // paths 1160 // paths
1162 baseShape.PCode = Convert.ToByte(shapeRow["PCode"]); 1161 baseShape.PCode = Convert.ToByte(shapeRow["PCode"]);
@@ -1193,8 +1192,11 @@ VALUES
1193 { 1192 {
1194 } 1193 }
1195 1194
1196 if (!(shapeRow["Media"] is System.DBNull)) 1195 if (!(shapeRow["Media"] is System.DBNull) )
1196 {
1197 baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); 1197 baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
1198 }
1199
1198 1200
1199 return baseShape; 1201 return baseShape;
1200 } 1202 }
@@ -1573,7 +1575,16 @@ VALUES
1573 parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry)); 1575 parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry));
1574 parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); 1576 parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams));
1575 parameters.Add(_Database.CreateParameter("State", s.State)); 1577 parameters.Add(_Database.CreateParameter("State", s.State));
1576 parameters.Add(_Database.CreateParameter("Media", null == s.Media ? null : s.Media.ToXml())); 1578
1579 if(null == s.Media )
1580 {
1581 parameters.Add(_Database.CreateParameter("Media", DBNull.Value));
1582 }
1583 else
1584 {
1585 parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml()));
1586 }
1587
1577 1588
1578 return parameters.ToArray(); 1589 return parameters.ToArray();
1579 } 1590 }
diff --git a/OpenSim/Data/MSSQL/Resources/AuthStore.migrations b/OpenSim/Data/MSSQL/Resources/AuthStore.migrations
index 5b90ca3..eb91296 100644
--- a/OpenSim/Data/MSSQL/Resources/AuthStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/AuthStore.migrations
@@ -22,7 +22,11 @@ COMMIT
22 22
23BEGIN TRANSACTION 23BEGIN TRANSACTION
24 24
25INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey, accountType) SELECT [UUID] AS UUID, [passwordHash] AS passwordHash, [passwordSalt] AS passwordSalt, [webLoginKey] AS webLoginKey, 'UserAccount' as [accountType] FROM users; 25IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users]') AND type in (N'U'))
26 INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey, accountType) SELECT [UUID] AS UUID, [passwordHash] AS passwordHash, [passwordSalt] AS passwordSalt, [webLoginKey] AS webLoginKey, 'UserAccount' as [accountType] FROM users;
27
28COMMIT
29
30
26 31
27 32
28COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/Avatar.migrations b/OpenSim/Data/MSSQL/Resources/Avatar.migrations
index 759e939..5364153 100644
--- a/OpenSim/Data/MSSQL/Resources/Avatar.migrations
+++ b/OpenSim/Data/MSSQL/Resources/Avatar.migrations
@@ -13,5 +13,28 @@ PRIMARY KEY CLUSTERED
13) ON [PRIMARY] 13) ON [PRIMARY]
14 14
15 15
16COMMIT
17
18:VERSION 2
19
20BEGIN TRANSACTION
21
22CREATE TABLE dbo.Tmp_Avatars
23 (
24 PrincipalID uniqueidentifier NOT NULL,
25 [Name] varchar(32) NOT NULL,
26 Value text NOT NULL DEFAULT '',
27 ) ON [PRIMARY]
28 TEXTIMAGE_ON [PRIMARY]
29
30IF EXISTS(SELECT * FROM dbo.Avatars)
31 EXEC('INSERT INTO dbo.Tmp_Avatars (PrincipalID, Name, Value)
32 SELECT PrincipalID, CONVERT(text, Name), Value FROM dbo.Avatars WITH (HOLDLOCK TABLOCKX)')
33
34DROP TABLE dbo.Avatars
35
36EXECUTE sp_rename N'dbo.Tmp_Avatars', N'Avatars', 'OBJECT'
37
38COMMIT
39
16 40
17COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations b/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations
index f981a91..4d8ab0f 100644
--- a/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations
@@ -15,6 +15,8 @@ COMMIT
15 15
16BEGIN TRANSACTION 16BEGIN TRANSACTION
17 17
18INSERT INTO Friends (PrincipalID, Friend, Flags, Offered) SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends; 18IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[userfriends]') AND type in (N'U'))
19INSERT INTO Friends (PrincipalID, Friend, Flags, Offered)
20SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends;
19 21
20COMMIT \ No newline at end of file 22COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/GridStore.migrations b/OpenSim/Data/MSSQL/Resources/GridStore.migrations
index d2ca27a..c6342fc 100644
--- a/OpenSim/Data/MSSQL/Resources/GridStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/GridStore.migrations
@@ -222,4 +222,17 @@ ALTER TABLE [regions] ADD [Token] varchar(255) NOT NULL DEFAULT 0;
222 222
223COMMIT 223COMMIT
224 224
225:VERSION 8
225 226
227BEGIN TRANSACTION
228ALTER TABLE regions ALTER COLUMN regionName VarChar(128)
229
230DROP INDEX IX_regions_name ON dbo.regions
231ALTER TABLE regions ALTER COLUMN regionName VarChar(128) null
232
233CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions
234 (
235 regionName
236 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
237
238COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations
index e2a8d57..4a3cb27 100644
--- a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations
@@ -238,7 +238,10 @@ alter table inventoryitems
238 238
239COMMIT 239COMMIT
240 240
241 241:VERSION 8
242
243
244 242
243ALTER TABLE inventoryitems
244ADD CONSTRAINT DF_inventoryitems_creatorID
245DEFAULT '00000000-0000-0000-0000-000000000000' FOR creatorID
246
247:GO \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/Presence.migrations b/OpenSim/Data/MSSQL/Resources/Presence.migrations
index 35f78e1..bcb6328 100644
--- a/OpenSim/Data/MSSQL/Resources/Presence.migrations
+++ b/OpenSim/Data/MSSQL/Resources/Presence.migrations
@@ -7,14 +7,7 @@ CREATE TABLE [Presence] (
7[RegionID] uniqueidentifier NOT NULL, 7[RegionID] uniqueidentifier NOT NULL,
8[SessionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', 8[SessionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
9[SecureSessionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', 9[SecureSessionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
10[Online] char(5) NOT NULL DEFAULT 'false', 10
11[Login] char(16) NOT NULL DEFAULT '0',
12[Logout] char(16) NOT NULL DEFAULT '0',
13[Position] char(64) NOT NULL DEFAULT '<0,0,0>',
14[LookAt] char(64) NOT NULL DEFAULT '<0,0,0>',
15[HomeRegionID] uniqueidentifier NOT NULL,
16[HomePosition] CHAR(64) NOT NULL DEFAULT '<0,0,0>',
17[HomeLookAt] CHAR(64) NOT NULL DEFAULT '<0,0,0>',
18) 11)
19 ON [PRIMARY] 12 ON [PRIMARY]
20 13
@@ -27,4 +20,12 @@ BEGIN TRANSACTION
27CREATE UNIQUE INDEX SessionID ON Presence(SessionID); 20CREATE UNIQUE INDEX SessionID ON Presence(SessionID);
28CREATE INDEX UserID ON Presence(UserID); 21CREATE INDEX UserID ON Presence(UserID);
29 22
23COMMIT
24
25:VERSION 2
26
27BEGIN TRANSACTION
28
29ALTER TABLE Presence ADD LastSeen DateTime
30
30COMMIT \ No newline at end of file 31COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
index e2e8cbb..340b63d 100644
--- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations
@@ -1,4 +1,3 @@
1
2:VERSION 1 1:VERSION 1
3 2
4CREATE TABLE [dbo].[prims]( 3CREATE TABLE [dbo].[prims](
@@ -926,11 +925,121 @@ ALTER TABLE regionsettings ADD loaded_creation_datetime int NOT NULL default 0
926COMMIT 925COMMIT
927 926
928:VERSION 24 927:VERSION 24
929-- Added post 0.7
930 928
931BEGIN TRANSACTION 929BEGIN TRANSACTION
932 930
933ALTER TABLE prims ADD COLUMN MediaURL varchar(255) 931ALTER TABLE prims ADD MediaURL varchar(255)
934ALTER TABLE primshapes ADD COLUMN Media TEXT 932ALTER TABLE primshapes ADD Media TEXT NULL
933
934COMMIT
935
936:VERSION 25
937
938BEGIN TRANSACTION
939CREATE TABLE "regionwindlight" (
940 "region_id" varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
941 "water_color_r" [float] NOT NULL DEFAULT '4.000000',
942 "water_color_g" [float] NOT NULL DEFAULT '38.000000',
943 "water_color_b" [float] NOT NULL DEFAULT '64.000000',
944 "water_fog_density_exponent" [float] NOT NULL DEFAULT '4.0',
945 "underwater_fog_modifier" [float] NOT NULL DEFAULT '0.25',
946 "reflection_wavelet_scale_1" [float] NOT NULL DEFAULT '2.0',
947 "reflection_wavelet_scale_2" [float] NOT NULL DEFAULT '2.0',
948 "reflection_wavelet_scale_3" [float] NOT NULL DEFAULT '2.0',
949 "fresnel_scale" [float] NOT NULL DEFAULT '0.40',
950 "fresnel_offset" [float] NOT NULL DEFAULT '0.50',
951 "refract_scale_above" [float] NOT NULL DEFAULT '0.03',
952 "refract_scale_below" [float] NOT NULL DEFAULT '0.20',
953 "blur_multiplier" [float] NOT NULL DEFAULT '0.040',
954 "big_wave_direction_x" [float] NOT NULL DEFAULT '1.05',
955 "big_wave_direction_y" [float] NOT NULL DEFAULT '-0.42',
956 "little_wave_direction_x" [float] NOT NULL DEFAULT '1.11',
957 "little_wave_direction_y" [float] NOT NULL DEFAULT '-1.16',
958 "normal_map_texture" varchar(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
959 "horizon_r" [float] NOT NULL DEFAULT '0.25',
960 "horizon_g" [float] NOT NULL DEFAULT '0.25',
961 "horizon_b" [float] NOT NULL DEFAULT '0.32',
962 "horizon_i" [float] NOT NULL DEFAULT '0.32',
963 "haze_horizon" [float] NOT NULL DEFAULT '0.19',
964 "blue_density_r" [float] NOT NULL DEFAULT '0.12',
965 "blue_density_g" [float] NOT NULL DEFAULT '0.22',
966 "blue_density_b" [float] NOT NULL DEFAULT '0.38',
967 "blue_density_i" [float] NOT NULL DEFAULT '0.38',
968 "haze_density" [float] NOT NULL DEFAULT '0.70',
969 "density_multiplier" [float] NOT NULL DEFAULT '0.18',
970 "distance_multiplier" [float] NOT NULL DEFAULT '0.8',
971 "max_altitude" int NOT NULL DEFAULT '1605',
972 "sun_moon_color_r" [float] NOT NULL DEFAULT '0.24',
973 "sun_moon_color_g" [float] NOT NULL DEFAULT '0.26',
974 "sun_moon_color_b" [float] NOT NULL DEFAULT '0.30',
975 "sun_moon_color_i" [float] NOT NULL DEFAULT '0.30',
976 "sun_moon_position" [float] NOT NULL DEFAULT '0.317',
977 "ambient_r" [float] NOT NULL DEFAULT '0.35',
978 "ambient_g" [float] NOT NULL DEFAULT '0.35',
979 "ambient_b" [float] NOT NULL DEFAULT '0.35',
980 "ambient_i" [float] NOT NULL DEFAULT '0.35',
981 "east_angle" [float] NOT NULL DEFAULT '0.00',
982 "sun_glow_focus" [float] NOT NULL DEFAULT '0.10',
983 "sun_glow_size" [float] NOT NULL DEFAULT '1.75',
984 "scene_gamma" [float] NOT NULL DEFAULT '1.00',
985 "star_brightness" [float] NOT NULL DEFAULT '0.00',
986 "cloud_color_r" [float] NOT NULL DEFAULT '0.41',
987 "cloud_color_g" [float] NOT NULL DEFAULT '0.41',
988 "cloud_color_b" [float] NOT NULL DEFAULT '0.41',
989 "cloud_color_i" [float] NOT NULL DEFAULT '0.41',
990 "cloud_x" [float] NOT NULL DEFAULT '1.00',
991 "cloud_y" [float] NOT NULL DEFAULT '0.53',
992 "cloud_density" [float] NOT NULL DEFAULT '1.00',
993 "cloud_coverage" [float] NOT NULL DEFAULT '0.27',
994 "cloud_scale" [float] NOT NULL DEFAULT '0.42',
995 "cloud_detail_x" [float] NOT NULL DEFAULT '1.00',
996 "cloud_detail_y" [float] NOT NULL DEFAULT '0.53',
997 "cloud_detail_density" [float] NOT NULL DEFAULT '0.12',
998 "cloud_scroll_x" [float] NOT NULL DEFAULT '0.20',
999 "cloud_scroll_x_lock" tinyint NOT NULL DEFAULT '0',
1000 "cloud_scroll_y" [float] NOT NULL DEFAULT '0.01',
1001 "cloud_scroll_y_lock" tinyint NOT NULL DEFAULT '0',
1002 "draw_classic_clouds" tinyint NOT NULL DEFAULT '1',
1003 PRIMARY KEY ("region_id")
1004)
1005
1006COMMIT TRANSACTION
1007
1008:VERSION 26
1009
1010BEGIN TRANSACTION
1011
1012ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
1013
1014COMMIT
1015
1016:VERSION 27 #---------------------
935 1017
936COMMIT \ No newline at end of file 1018BEGIN TRANSACTION
1019ALTER TABLE land ADD MediaType VARCHAR(32) NOT NULL DEFAULT 'none/none'
1020ALTER TABLE land ADD MediaDescription VARCHAR(255) NOT NULL DEFAULT ''
1021ALTER TABLE land ADD MediaSize VARCHAR(16) NOT NULL DEFAULT '0,0'
1022ALTER TABLE land ADD MediaLoop bit NOT NULL DEFAULT 0
1023ALTER TABLE land ADD ObscureMusic bit NOT NULL DEFAULT 0
1024ALTER TABLE land ADD ObscureMedia bit NOT NULL DEFAULT 0
1025COMMIT
1026
1027:VERSION 28 #---------------------
1028
1029BEGIN TRANSACTION
1030
1031ALTER TABLE prims
1032ADD CONSTRAINT DF_prims_CreatorID
1033DEFAULT '00000000-0000-0000-0000-000000000000'
1034FOR CreatorID
1035
1036ALTER TABLE prims ALTER COLUMN CreatorID uniqueidentifier NOT NULL
1037
1038ALTER TABLE primitems
1039ADD CONSTRAINT DF_primitems_CreatorID
1040DEFAULT '00000000-0000-0000-0000-000000000000'
1041FOR CreatorID
1042
1043ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
1044
1045COMMIT
diff --git a/OpenSim/Data/MSSQL/Resources/UserAccount.migrations b/OpenSim/Data/MSSQL/Resources/UserAccount.migrations
index 8534e23..a81704d 100644
--- a/OpenSim/Data/MSSQL/Resources/UserAccount.migrations
+++ b/OpenSim/Data/MSSQL/Resources/UserAccount.migrations
@@ -19,7 +19,7 @@ CREATE TABLE [UserAccounts] (
19:VERSION 2 19:VERSION 2
20 20
21BEGIN TRANSACTION 21BEGIN TRANSACTION
22 22IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users]') AND type in (N'U'))
23INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT [UUID] AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, 23INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT [UUID] AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID,
24username AS FirstName, 24username AS FirstName,
25lastname AS LastName, 25lastname AS LastName,
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 3dbc215..dbd47d3 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -152,27 +152,6 @@ namespace OpenSim.Framework
152 } 152 }
153 153
154 /// <summary> 154 /// <summary>
155 /// Create AgentCircuitData from a Serializable AgentCircuitData
156 /// </summary>
157 /// <param name="cAgent"></param>
158 public AgentCircuitData(sAgentCircuitData cAgent)
159 {
160 AgentID = new UUID(cAgent.AgentID);
161 SessionID = new UUID(cAgent.SessionID);
162 SecureSessionID = new UUID(cAgent.SecureSessionID);
163 startpos = new Vector3(cAgent.startposx, cAgent.startposy, cAgent.startposz);
164 firstname = cAgent.firstname;
165 lastname = cAgent.lastname;
166 circuitcode = cAgent.circuitcode;
167 child = cAgent.child;
168 InventoryFolder = new UUID(cAgent.InventoryFolder);
169 BaseFolder = new UUID(cAgent.BaseFolder);
170 CapsPath = cAgent.CapsPath;
171 ChildrenCapSeeds = cAgent.ChildrenCapSeeds;
172 Viewer = cAgent.Viewer;
173 }
174
175 /// <summary>
176 /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json 155 /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
177 /// </summary> 156 /// </summary>
178 /// <returns>map of the agent circuit data</returns> 157 /// <returns>map of the agent circuit data</returns>
@@ -369,52 +348,4 @@ namespace OpenSim.Framework
369 } 348 }
370 349
371 350
372 /// <summary>
373 /// Serializable Agent Circuit Data
374 /// </summary>
375 [Serializable]
376 public class sAgentCircuitData
377 {
378 public Guid AgentID;
379 public Guid BaseFolder;
380 public string CapsPath = String.Empty;
381 public Dictionary<ulong, string> ChildrenCapSeeds;
382 public bool child;
383 public uint circuitcode;
384 public string firstname;
385 public Guid InventoryFolder;
386 public string lastname;
387 public Guid SecureSessionID;
388 public Guid SessionID;
389 public float startposx;
390 public float startposy;
391 public float startposz;
392 public string Viewer;
393 public string Channel;
394 public string Mac;
395 public string Id0;
396
397 public sAgentCircuitData()
398 {
399 }
400
401 public sAgentCircuitData(AgentCircuitData cAgent)
402 {
403 AgentID = cAgent.AgentID.Guid;
404 SessionID = cAgent.SessionID.Guid;
405 SecureSessionID = cAgent.SecureSessionID.Guid;
406 startposx = cAgent.startpos.X;
407 startposy = cAgent.startpos.Y;
408 startposz = cAgent.startpos.Z;
409 firstname = cAgent.firstname;
410 lastname = cAgent.lastname;
411 circuitcode = cAgent.circuitcode;
412 child = cAgent.child;
413 InventoryFolder = cAgent.InventoryFolder.Guid;
414 BaseFolder = cAgent.BaseFolder.Guid;
415 CapsPath = cAgent.CapsPath;
416 ChildrenCapSeeds = cAgent.ChildrenCapSeeds;
417 Viewer = cAgent.Viewer;
418 }
419 }
420} 351}
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index ce0b2fb..a626b82 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Framework
62 UUID AgentID { get; set; } 62 UUID AgentID { get; set; }
63 63
64 OSDMap Pack(); 64 OSDMap Pack();
65 void Unpack(OSDMap map); 65 void Unpack(OSDMap map, IScene scene);
66 } 66 }
67 67
68 /// <summary> 68 /// <summary>
@@ -122,7 +122,7 @@ namespace OpenSim.Framework
122 return args; 122 return args;
123 } 123 }
124 124
125 public void Unpack(OSDMap args) 125 public void Unpack(OSDMap args, IScene scene)
126 { 126 {
127 if (args.ContainsKey("region_handle")) 127 if (args.ContainsKey("region_handle"))
128 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); 128 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
@@ -329,6 +329,10 @@ namespace OpenSim.Framework
329 329
330 public string CallbackURI; 330 public string CallbackURI;
331 331
332 // These two must have the same Count
333 public List<ISceneObject> AttachmentObjects;
334 public List<string> AttachmentObjectStates;
335
332 public virtual OSDMap Pack() 336 public virtual OSDMap Pack()
333 { 337 {
334 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 338 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
@@ -441,7 +445,30 @@ namespace OpenSim.Framework
441 if ((CallbackURI != null) && (!CallbackURI.Equals(""))) 445 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
442 args["callback_uri"] = OSD.FromString(CallbackURI); 446 args["callback_uri"] = OSD.FromString(CallbackURI);
443 447
448 // Attachment objects for fatpack messages
449 if (AttachmentObjects != null)
450 {
451 int i = 0;
452 OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
453 foreach (ISceneObject so in AttachmentObjects)
454 {
455 OSDMap info = new OSDMap(4);
456 info["sog"] = OSD.FromString(so.ToXml2());
457 info["extra"] = OSD.FromString(so.ExtraToXmlString());
458 info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
459 try
460 {
461 info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
462 }
463 catch (IndexOutOfRangeException e)
464 {
465 m_log.WarnFormat("[CHILD AGENT DATA]: scrtips list is shorter than object list.");
466 }
444 467
468 attObjs.Add(info);
469 }
470 args["attach_objects"] = attObjs;
471 }
445 return args; 472 return args;
446 } 473 }
447 474
@@ -450,7 +477,7 @@ namespace OpenSim.Framework
450 /// Avoiding reflection makes it painful to write, but that's the price! 477 /// Avoiding reflection makes it painful to write, but that's the price!
451 /// </summary> 478 /// </summary>
452 /// <param name="hash"></param> 479 /// <param name="hash"></param>
453 public virtual void Unpack(OSDMap args) 480 public virtual void Unpack(OSDMap args, IScene scene)
454 { 481 {
455 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); 482 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
456 483
@@ -628,6 +655,26 @@ namespace OpenSim.Framework
628 655
629 if (args["callback_uri"] != null) 656 if (args["callback_uri"] != null)
630 CallbackURI = args["callback_uri"].AsString(); 657 CallbackURI = args["callback_uri"].AsString();
658
659 // Attachment objects
660 if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
661 {
662 OSDArray attObjs = (OSDArray)(args["attach_objects"]);
663 AttachmentObjects = new List<ISceneObject>();
664 AttachmentObjectStates = new List<string>();
665 foreach (OSD o in attObjs)
666 {
667 if (o.Type == OSDType.Map)
668 {
669 OSDMap info = (OSDMap)o;
670 ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
671 so.ExtraFromXmlString(info["extra"].AsString());
672 so.HasGroupChanged = info["modified"].AsBoolean();
673 AttachmentObjects.Add(so);
674 AttachmentObjectStates.Add(info["state"].AsString());
675 }
676 }
677 }
631 } 678 }
632 679
633 public AgentData() 680 public AgentData()
@@ -655,9 +702,9 @@ namespace OpenSim.Framework
655 return base.Pack(); 702 return base.Pack();
656 } 703 }
657 704
658 public override void Unpack(OSDMap map) 705 public override void Unpack(OSDMap map, IScene scene)
659 { 706 {
660 base.Unpack(map); 707 base.Unpack(map, scene);
661 } 708 }
662 } 709 }
663} 710}
diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs
index fbd18b5..62acb70 100644
--- a/OpenSim/Framework/ClientInfo.cs
+++ b/OpenSim/Framework/ClientInfo.cs
@@ -31,10 +31,9 @@ using System.Net;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
33{ 33{
34 [Serializable]
35 public class ClientInfo 34 public class ClientInfo
36 { 35 {
37 public sAgentCircuitData agentcircuit; 36 public AgentCircuitData agentcircuit;
38 37
39 public Dictionary<uint, byte[]> needAck; 38 public Dictionary<uint, byte[]> needAck;
40 39
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index 52bcd55..be36cf2 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -592,9 +592,7 @@ namespace OpenSim.Framework.Console
592 string line = ReadLine(m_defaultPrompt + "# ", true, true); 592 string line = ReadLine(m_defaultPrompt + "# ", true, true);
593 593
594 if (line != String.Empty) 594 if (line != String.Empty)
595 { 595 Output("Invalid command");
596 m_log.Info("[CONSOLE] Invalid command");
597 }
598 } 596 }
599 597
600 public void RunCommand(string cmd) 598 public void RunCommand(string cmd)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index f573c32..069987b 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -572,34 +572,69 @@ namespace OpenSim.Framework
572 572
573 public class IEntityUpdate 573 public class IEntityUpdate
574 { 574 {
575 public ISceneEntity Entity; 575 private ISceneEntity m_entity;
576 public uint Flags; 576 private uint m_flags;
577 private int m_updateTime;
578
579 public ISceneEntity Entity
580 {
581 get { return m_entity; }
582 }
583
584 public uint Flags
585 {
586 get { return m_flags; }
587 }
588
589 public int UpdateTime
590 {
591 get { return m_updateTime; }
592 }
577 593
578 public virtual void Update(IEntityUpdate update) 594 public virtual void Update(IEntityUpdate update)
579 { 595 {
580 this.Flags |= update.Flags; 596 m_flags |= update.Flags;
597
598 // Use the older of the updates as the updateTime
599 if (Util.EnvironmentTickCountCompare(UpdateTime, update.UpdateTime) > 0)
600 m_updateTime = update.UpdateTime;
581 } 601 }
582 602
583 public IEntityUpdate(ISceneEntity entity, uint flags) 603 public IEntityUpdate(ISceneEntity entity, uint flags)
584 { 604 {
585 Entity = entity; 605 m_entity = entity;
586 Flags = flags; 606 m_flags = flags;
607 m_updateTime = Util.EnvironmentTickCount();
608 }
609
610 public IEntityUpdate(ISceneEntity entity, uint flags, Int32 updateTime)
611 {
612 m_entity = entity;
613 m_flags = flags;
614 m_updateTime = updateTime;
587 } 615 }
588 } 616 }
589
590 617
591 public class EntityUpdate : IEntityUpdate 618 public class EntityUpdate : IEntityUpdate
592 { 619 {
593 // public ISceneEntity Entity; 620 private float m_timeDilation;
594 // public PrimUpdateFlags Flags; 621
595 public float TimeDilation; 622 public float TimeDilation
623 {
624 get { return m_timeDilation; }
625 }
596 626
597 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation) 627 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
598 : base(entity,(uint)flags) 628 : base(entity, (uint)flags)
599 { 629 {
600 //Entity = entity;
601 // Flags = flags; 630 // Flags = flags;
602 TimeDilation = timedilation; 631 m_timeDilation = timedilation;
632 }
633
634 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation, Int32 updateTime)
635 : base(entity,(uint)flags,updateTime)
636 {
637 m_timeDilation = timedilation;
603 } 638 }
604 } 639 }
605 640
diff --git a/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index b62ec07..3e6fdaa 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -34,50 +34,81 @@ using OpenSim.Framework;
34using OpenSim.Framework.Client; 34using OpenSim.Framework.Client;
35using log4net; 35using log4net;
36 36
37namespace OpenSim.Region.ClientStack.LindenUDP 37namespace OpenSim.Framework
38{ 38{
39 public class PriorityQueue 39 public class PriorityQueue
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); 43 public delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
44 44
45 // Heap[0] for self updates 45 /// <summary>
46 // Heap[1..12] for entity updates 46 /// Total number of queues (priorities) available
47 /// </summary>
48 public const uint NumberOfQueues = 12;
47 49
48 internal const uint m_numberOfQueues = 12; 50 /// <summary>
51 /// Number of queuest (priorities) that are processed immediately
52 /// </summary.
53 public const uint NumberOfImmediateQueues = 2;
49 54
50 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[m_numberOfQueues]; 55 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[NumberOfQueues];
51 private Dictionary<uint, LookupItem> m_lookupTable; 56 private Dictionary<uint, LookupItem> m_lookupTable;
57
58 // internal state used to ensure the deqeues are spread across the priority
59 // queues "fairly". queuecounts is the amount to pull from each queue in
60 // each pass. weighted towards the higher priority queues
52 private uint m_nextQueue = 0; 61 private uint m_nextQueue = 0;
62 private uint m_countFromQueue = 0;
63 private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 };
64
65 // next request is a counter of the number of updates queued, it provides
66 // a total ordering on the updates coming through the queue and is more
67 // lightweight (and more discriminating) than tick count
53 private UInt64 m_nextRequest = 0; 68 private UInt64 m_nextRequest = 0;
54 69
70 /// <summary>
71 /// Lock for enqueue and dequeue operations on the priority queue
72 /// </summary>
55 private object m_syncRoot = new object(); 73 private object m_syncRoot = new object();
56 public object SyncRoot { 74 public object SyncRoot {
57 get { return this.m_syncRoot; } 75 get { return this.m_syncRoot; }
58 } 76 }
59 77
60 internal PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { } 78#region constructor
79 public PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { }
61 80
62 internal PriorityQueue(int capacity) 81 public PriorityQueue(int capacity)
63 { 82 {
64 m_lookupTable = new Dictionary<uint, LookupItem>(capacity); 83 m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
65 84
66 for (int i = 0; i < m_heaps.Length; ++i) 85 for (int i = 0; i < m_heaps.Length; ++i)
67 m_heaps[i] = new MinHeap<MinHeapItem>(capacity); 86 m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
87
88 m_nextQueue = NumberOfImmediateQueues;
89 m_countFromQueue = m_queueCounts[m_nextQueue];
68 } 90 }
91#endregion Constructor
69 92
70 internal int Count 93#region PublicMethods
94 /// <summary>
95 /// Return the number of items in the queues
96 /// </summary>
97 public int Count
71 { 98 {
72 get 99 get
73 { 100 {
74 int count = 0; 101 int count = 0;
75 for (int i = 0; i < m_heaps.Length; ++i) 102 for (int i = 0; i < m_heaps.Length; ++i)
76 count += m_heaps[i].Count; 103 count += m_heaps[i].Count;
104
77 return count; 105 return count;
78 } 106 }
79 } 107 }
80 108
109 /// <summary>
110 /// Enqueue an item into the specified priority queue
111 /// </summary>
81 public bool Enqueue(uint pqueue, IEntityUpdate value) 112 public bool Enqueue(uint pqueue, IEntityUpdate value)
82 { 113 {
83 LookupItem lookup; 114 LookupItem lookup;
@@ -91,7 +122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
91 lookup.Heap.Remove(lookup.Handle); 122 lookup.Heap.Remove(lookup.Handle);
92 } 123 }
93 124
94 pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1); 125 pqueue = Util.Clamp<uint>(pqueue, 0, NumberOfQueues - 1);
95 lookup.Heap = m_heaps[pqueue]; 126 lookup.Heap = m_heaps[pqueue];
96 lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle); 127 lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
97 m_lookupTable[localid] = lookup; 128 m_lookupTable[localid] = lookup;
@@ -99,20 +130,62 @@ namespace OpenSim.Region.ClientStack.LindenUDP
99 return true; 130 return true;
100 } 131 }
101 132
102 internal bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) 133 /// <summary>
134 /// Remove an item from one of the queues. Specifically, it removes the
135 /// oldest item from the next queue in order to provide fair access to
136 /// all of the queues
137 /// </summary>
138 public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
103 { 139 {
104 for (int i = 0; i < m_numberOfQueues; ++i) 140 // If there is anything in priority queue 0, return it first no
141 // matter what else. Breaks fairness. But very useful.
142 for (int iq = 0; iq < NumberOfImmediateQueues; iq++)
105 { 143 {
106 // To get the fair queing, we cycle through each of the 144 if (m_heaps[iq].Count > 0)
107 // queues when finding an element to dequeue, this code
108 // assumes that the distribution of updates in the queues
109 // is polynomial, probably quadractic (eg distance of PI * R^2)
110 uint h = (uint)((m_nextQueue + i) % m_numberOfQueues);
111 if (m_heaps[h].Count > 0)
112 { 145 {
113 m_nextQueue = (uint)((h + 1) % m_numberOfQueues); 146 MinHeapItem item = m_heaps[iq].RemoveMin();
147 m_lookupTable.Remove(item.Value.Entity.LocalId);
148 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
149 value = item.Value;
114 150
115 MinHeapItem item = m_heaps[h].RemoveMin(); 151 return true;
152 }
153 }
154
155 // To get the fair queing, we cycle through each of the
156 // queues when finding an element to dequeue.
157 // We pull (NumberOfQueues - QueueIndex) items from each queue in order
158 // to give lower numbered queues a higher priority and higher percentage
159 // of the bandwidth.
160
161 // Check for more items to be pulled from the current queue
162 if (m_heaps[m_nextQueue].Count > 0 && m_countFromQueue > 0)
163 {
164 m_countFromQueue--;
165
166 MinHeapItem item = m_heaps[m_nextQueue].RemoveMin();
167 m_lookupTable.Remove(item.Value.Entity.LocalId);
168 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
169 value = item.Value;
170
171 return true;
172 }
173
174 // Find the next non-immediate queue with updates in it
175 for (int i = 0; i < NumberOfQueues; ++i)
176 {
177 m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues);
178 m_countFromQueue = m_queueCounts[m_nextQueue];
179
180 // if this is one of the immediate queues, just skip it
181 if (m_nextQueue < NumberOfImmediateQueues)
182 continue;
183
184 if (m_heaps[m_nextQueue].Count > 0)
185 {
186 m_countFromQueue--;
187
188 MinHeapItem item = m_heaps[m_nextQueue].RemoveMin();
116 m_lookupTable.Remove(item.Value.Entity.LocalId); 189 m_lookupTable.Remove(item.Value.Entity.LocalId);
117 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); 190 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
118 value = item.Value; 191 value = item.Value;
@@ -126,7 +199,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
126 return false; 199 return false;
127 } 200 }
128 201
129 internal void Reprioritize(UpdatePriorityHandler handler) 202 /// <summary>
203 /// Reapply the prioritization function to each of the updates currently
204 /// stored in the priority queues.
205 /// </summary
206 public void Reprioritize(UpdatePriorityHandler handler)
130 { 207 {
131 MinHeapItem item; 208 MinHeapItem item;
132 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values)) 209 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
@@ -140,7 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
140 { 217 {
141 // unless the priority queue has changed, there is no need to modify 218 // unless the priority queue has changed, there is no need to modify
142 // the entry 219 // the entry
143 pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1); 220 pqueue = Util.Clamp<uint>(pqueue, 0, NumberOfQueues - 1);
144 if (pqueue != item.PriorityQueue) 221 if (pqueue != item.PriorityQueue)
145 { 222 {
146 lookup.Heap.Remove(lookup.Handle); 223 lookup.Heap.Remove(lookup.Handle);
@@ -161,17 +238,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
161 } 238 }
162 } 239 }
163 240
241 /// <summary>
242 /// </summary>
164 public override string ToString() 243 public override string ToString()
165 { 244 {
166 string s = ""; 245 string s = "";
167 for (int i = 0; i < m_numberOfQueues; i++) 246 for (int i = 0; i < NumberOfQueues; i++)
168 { 247 s += String.Format("{0,7} ",m_heaps[i].Count);
169 if (s != "") s += ",";
170 s += m_heaps[i].Count.ToString();
171 }
172 return s; 248 return s;
173 } 249 }
174 250
251#endregion PublicMethods
252
175#region MinHeapItem 253#region MinHeapItem
176 private struct MinHeapItem : IComparable<MinHeapItem> 254 private struct MinHeapItem : IComparable<MinHeapItem>
177 { 255 {
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index daf0a25..239ce3d 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -369,6 +369,7 @@ namespace OpenSim.Framework
369 private int m_physPrimMax = 0; 369 private int m_physPrimMax = 0;
370 private bool m_clampPrimSize = false; 370 private bool m_clampPrimSize = false;
371 private int m_objectCapacity = 0; 371 private int m_objectCapacity = 0;
372 private int m_agentCapacity = 0;
372 private string m_regionType = String.Empty; 373 private string m_regionType = String.Empty;
373 private RegionLightShareData m_windlight = new RegionLightShareData(); 374 private RegionLightShareData m_windlight = new RegionLightShareData();
374 protected uint m_httpPort; 375 protected uint m_httpPort;
@@ -547,6 +548,11 @@ namespace OpenSim.Framework
547 get { return m_objectCapacity; } 548 get { return m_objectCapacity; }
548 } 549 }
549 550
551 public int AgentCapacity
552 {
553 get { return m_agentCapacity; }
554 }
555
550 public byte AccessLevel 556 public byte AccessLevel
551 { 557 {
552 get { return (byte)Util.ConvertMaturityToAccessLevel((uint)RegionSettings.Maturity); } 558 get { return (byte)Util.ConvertMaturityToAccessLevel((uint)RegionSettings.Maturity); }
@@ -821,6 +827,8 @@ namespace OpenSim.Framework
821 827
822 m_objectCapacity = config.GetInt("MaxPrims", 15000); 828 m_objectCapacity = config.GetInt("MaxPrims", 15000);
823 829
830 m_agentCapacity = config.GetInt("MaxAgents", 100);
831
824 832
825 // Multi-tenancy 833 // Multi-tenancy
826 // 834 //
@@ -857,6 +865,9 @@ namespace OpenSim.Framework
857 if (m_objectCapacity != 0) 865 if (m_objectCapacity != 0)
858 config.Set("MaxPrims", m_objectCapacity); 866 config.Set("MaxPrims", m_objectCapacity);
859 867
868 if (m_agentCapacity != 0)
869 config.Set("MaxAgents", m_agentCapacity);
870
860 if (ScopeID != UUID.Zero) 871 if (ScopeID != UUID.Zero)
861 config.Set("ScopeID", ScopeID.ToString()); 872 config.Set("ScopeID", ScopeID.ToString());
862 873
@@ -943,6 +954,9 @@ namespace OpenSim.Framework
943 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 954 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
944 "Max objects this sim will hold", m_objectCapacity.ToString(), true); 955 "Max objects this sim will hold", m_objectCapacity.ToString(), true);
945 956
957 configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
958 "Max avatars this sim will hold", m_agentCapacity.ToString(), true);
959
946 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, 960 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
947 "Scope ID for this region", ScopeID.ToString(), true); 961 "Scope ID for this region", ScopeID.ToString(), true);
948 962
@@ -1055,6 +1069,9 @@ namespace OpenSim.Framework
1055 case "object_capacity": 1069 case "object_capacity":
1056 m_objectCapacity = (int)configuration_result; 1070 m_objectCapacity = (int)configuration_result;
1057 break; 1071 break;
1072 case "agent_capacity":
1073 m_agentCapacity = (int)configuration_result;
1074 break;
1058 case "scope_id": 1075 case "scope_id":
1059 ScopeID = (UUID)configuration_result; 1076 ScopeID = (UUID)configuration_result;
1060 break; 1077 break;
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index c9d4c93..53a3f17 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.7.1"; 32 private const string VERSION_NUMBER = "0.7.2";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 34
35 public enum Flavour 35 public enum Flavour
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index e7f8bfc..76de6be 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -115,7 +115,7 @@ namespace OpenSim.Framework.Tests
115 position2 = new AgentPosition(); 115 position2 = new AgentPosition();
116 116
117 Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition"); 117 Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
118 position2.Unpack(position1.Pack()); 118 position2.Unpack(position1.Pack(), null);
119 119
120 Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed"); 120 Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
121 Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed"); 121 Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5a5046e..aaa2724 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1537,6 +1537,23 @@ namespace OpenSim.Framework
1537 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); 1537 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
1538 } 1538 }
1539 1539
1540 // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount
1541 // Assumes both tcA and tcB came from previous calls to Util.EnvironmentTickCount().
1542 // A positive return value indicates A occured later than B
1543 public static Int32 EnvironmentTickCountCompare(Int32 tcA, Int32 tcB)
1544 {
1545 // A, B and TC are all between 0 and 0x3fffffff
1546 int tc = EnvironmentTickCount();
1547
1548 if (tc - tcA >= 0)
1549 tcA += EnvironmentTickCountMask + 1;
1550
1551 if (tc - tcB >= 0)
1552 tcB += EnvironmentTickCountMask + 1;
1553
1554 return tcA - tcB;
1555 }
1556
1540 /// <summary> 1557 /// <summary>
1541 /// Prints the call stack at any given point. Useful for debugging. 1558 /// Prints the call stack at any given point. Useful for debugging.
1542 /// </summary> 1559 /// </summary>
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 1f7e66d..43903ce 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -385,6 +385,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
385 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 385 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
386 386
387 /// <summary> 387 /// <summary>
388 /// Entity update queues
389 /// </summary>
390 public PriorityQueue EntityUpdateQueue { get { return m_entityUpdates; } }
391
392 /// <summary>
388 /// First name of the agent/avatar represented by the client 393 /// First name of the agent/avatar represented by the client
389 /// </summary> 394 /// </summary>
390 public string FirstName { get { return m_firstName; } } 395 public string FirstName { get { return m_firstName; } }
@@ -3561,6 +3566,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3561 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); 3566 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation));
3562 } 3567 }
3563 3568
3569 /// <summary>
3570 /// Requeue an EntityUpdate when it was not acknowledged by the client.
3571 /// We will update the priority and put it in the correct queue, merging update flags
3572 /// with any other updates that may be queued for the same entity.
3573 /// The original update time is used for the merged update.
3574 /// </summary>
3575 private void ResendPrimUpdate(EntityUpdate update)
3576 {
3577 // If the update exists in priority queue, it will be updated.
3578 // If it does not exist then it will be added with the current (rather than its original) priority
3579 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity);
3580
3581 lock (m_entityUpdates.SyncRoot)
3582 m_entityUpdates.Enqueue(priority, update);
3583 }
3584
3585 /// <summary>
3586 /// Requeue a list of EntityUpdates when they were not acknowledged by the client.
3587 /// We will update the priority and put it in the correct queue, merging update flags
3588 /// with any other updates that may be queued for the same entity.
3589 /// The original update time is used for the merged update.
3590 /// </summary>
3591 private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket)
3592 {
3593 // m_log.WarnFormat("[CLIENT] resending prim update {0}",updates[0].UpdateTime);
3594
3595 // Remove the update packet from the list of packets waiting for acknowledgement
3596 // because we are requeuing the list of updates. They will be resent in new packets
3597 // with the most recent state and priority.
3598 m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
3599
3600 // Count this as a resent packet since we are going to requeue all of the updates contained in it
3601 Interlocked.Increment(ref m_udpClient.PacketsResent);
3602
3603 foreach (EntityUpdate update in updates)
3604 ResendPrimUpdate(update);
3605 }
3606
3564 private void ProcessEntityUpdates(int maxUpdates) 3607 private void ProcessEntityUpdates(int maxUpdates)
3565 { 3608 {
3566 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); 3609 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
@@ -3568,6 +3611,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3568 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); 3611 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3569 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); 3612 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3570 3613
3614 OpenSim.Framework.Lazy<List<EntityUpdate>> objectUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3615 OpenSim.Framework.Lazy<List<EntityUpdate>> compressedUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3616 OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3617 OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3618
3571 // Check to see if this is a flush 3619 // Check to see if this is a flush
3572 if (maxUpdates <= 0) 3620 if (maxUpdates <= 0)
3573 { 3621 {
@@ -3583,7 +3631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3583 float avgTimeDilation = 1.0f; 3631 float avgTimeDilation = 1.0f;
3584 IEntityUpdate iupdate; 3632 IEntityUpdate iupdate;
3585 Int32 timeinqueue; // this is just debugging code & can be dropped later 3633 Int32 timeinqueue; // this is just debugging code & can be dropped later
3586 3634
3587 while (updatesThisCall < maxUpdates) 3635 while (updatesThisCall < maxUpdates)
3588 { 3636 {
3589 lock (m_entityUpdates.SyncRoot) 3637 lock (m_entityUpdates.SyncRoot)
@@ -3688,24 +3736,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3688 if (update.Entity is ScenePresence) 3736 if (update.Entity is ScenePresence)
3689 { 3737 {
3690 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); 3738 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3739 objectUpdates.Value.Add(update);
3691 } 3740 }
3692 else 3741 else
3693 { 3742 {
3694 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); 3743 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3744 objectUpdates.Value.Add(update);
3695 } 3745 }
3696 } 3746 }
3697 else if (!canUseImproved) 3747 else if (!canUseImproved)
3698 { 3748 {
3699 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); 3749 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
3750 compressedUpdates.Value.Add(update);
3700 } 3751 }
3701 else 3752 else
3702 { 3753 {
3703 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 3754 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
3755 {
3704 // Self updates go into a special list 3756 // Self updates go into a special list
3705 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); 3757 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3758 terseAgentUpdates.Value.Add(update);
3759 }
3706 else 3760 else
3761 {
3707 // Everything else goes here 3762 // Everything else goes here
3708 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); 3763 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3764 terseUpdates.Value.Add(update);
3765 }
3709 } 3766 }
3710 3767
3711 #endregion Block Construction 3768 #endregion Block Construction
@@ -3713,28 +3770,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3713 3770
3714 3771
3715 #region Packet Sending 3772 #region Packet Sending
3716
3717 //const float TIME_DILATION = 1.0f;
3718
3719
3720 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); 3773 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3721 3774
3722 if (terseAgentUpdateBlocks.IsValueCreated) 3775 if (terseAgentUpdateBlocks.IsValueCreated)
3723 { 3776 {
3724 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; 3777 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3725 3778
3726 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3779 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket();
3727 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3780 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3728 packet.RegionData.TimeDilation = timeDilation; 3781 packet.RegionData.TimeDilation = timeDilation;
3729 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3782 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
3730 3783
3731 for (int i = 0; i < blocks.Count; i++) 3784 for (int i = 0; i < blocks.Count; i++)
3732 packet.ObjectData[i] = blocks[i]; 3785 packet.ObjectData[i] = blocks[i];
3733 3786 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3734 3787 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); });
3735 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
3736 } 3788 }
3737 3789
3738 if (objectUpdateBlocks.IsValueCreated) 3790 if (objectUpdateBlocks.IsValueCreated)
3739 { 3791 {
3740 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; 3792 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
@@ -3746,8 +3798,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3746 3798
3747 for (int i = 0; i < blocks.Count; i++) 3799 for (int i = 0; i < blocks.Count; i++)
3748 packet.ObjectData[i] = blocks[i]; 3800 packet.ObjectData[i] = blocks[i];
3749 3801 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3750 OutPacket(packet, ThrottleOutPacketType.Task, true); 3802 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
3751 } 3803 }
3752 3804
3753 if (compressedUpdateBlocks.IsValueCreated) 3805 if (compressedUpdateBlocks.IsValueCreated)
@@ -3761,10 +3813,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3761 3813
3762 for (int i = 0; i < blocks.Count; i++) 3814 for (int i = 0; i < blocks.Count; i++)
3763 packet.ObjectData[i] = blocks[i]; 3815 packet.ObjectData[i] = blocks[i];
3764 3816 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3765 OutPacket(packet, ThrottleOutPacketType.Task, true); 3817 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
3766 } 3818 }
3767 3819
3768 if (terseUpdateBlocks.IsValueCreated) 3820 if (terseUpdateBlocks.IsValueCreated)
3769 { 3821 {
3770 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 3822 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
@@ -3776,8 +3828,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3776 3828
3777 for (int i = 0; i < blocks.Count; i++) 3829 for (int i = 0; i < blocks.Count; i++)
3778 packet.ObjectData[i] = blocks[i]; 3830 packet.ObjectData[i] = blocks[i];
3779 3831 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
3780 OutPacket(packet, ThrottleOutPacketType.Task, true); 3832 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
3781 } 3833 }
3782 } 3834 }
3783 3835
@@ -3969,7 +4021,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3969 { 4021 {
3970 SendFamilyProps = SendFamilyProps || update.SendFamilyProps; 4022 SendFamilyProps = SendFamilyProps || update.SendFamilyProps;
3971 SendObjectProps = SendObjectProps || update.SendObjectProps; 4023 SendObjectProps = SendObjectProps || update.SendObjectProps;
3972 Flags |= update.Flags; 4024 // other properties may need to be updated by base class
4025 base.Update(update);
3973 } 4026 }
3974 } 4027 }
3975 4028
@@ -3980,6 +4033,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3980 m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,requestFlags,true,false)); 4033 m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,requestFlags,true,false));
3981 } 4034 }
3982 4035
4036 private void ResendPropertyUpdate(ObjectPropertyUpdate update)
4037 {
4038 uint priority = 0;
4039 lock (m_entityProps.SyncRoot)
4040 m_entityProps.Enqueue(priority, update);
4041 }
4042
4043 private void ResendPropertyUpdates(List<ObjectPropertyUpdate> updates, OutgoingPacket oPacket)
4044 {
4045 // m_log.WarnFormat("[CLIENT] resending object property {0}",updates[0].UpdateTime);
4046
4047 // Remove the update packet from the list of packets waiting for acknowledgement
4048 // because we are requeuing the list of updates. They will be resent in new packets
4049 // with the most recent state.
4050 m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
4051
4052 // Count this as a resent packet since we are going to requeue all of the updates contained in it
4053 Interlocked.Increment(ref m_udpClient.PacketsResent);
4054
4055 foreach (ObjectPropertyUpdate update in updates)
4056 ResendPropertyUpdate(update);
4057 }
4058
3983 public void SendObjectPropertiesReply(ISceneEntity entity) 4059 public void SendObjectPropertiesReply(ISceneEntity entity)
3984 { 4060 {
3985 uint priority = 0; // time based ordering only 4061 uint priority = 0; // time based ordering only
@@ -3995,6 +4071,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3995 OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>> objectPropertiesBlocks = 4071 OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>> objectPropertiesBlocks =
3996 new OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>>(); 4072 new OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>>();
3997 4073
4074 OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> familyUpdates =
4075 new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
4076
4077 OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates =
4078 new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
4079
3998 IEntityUpdate iupdate; 4080 IEntityUpdate iupdate;
3999 Int32 timeinqueue; // this is just debugging code & can be dropped later 4081 Int32 timeinqueue; // this is just debugging code & can be dropped later
4000 4082
@@ -4013,6 +4095,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4013 SceneObjectPart sop = (SceneObjectPart)update.Entity; 4095 SceneObjectPart sop = (SceneObjectPart)update.Entity;
4014 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesFamilyBlock(sop,update.Flags); 4096 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesFamilyBlock(sop,update.Flags);
4015 objectFamilyBlocks.Value.Add(objPropDB); 4097 objectFamilyBlocks.Value.Add(objPropDB);
4098 familyUpdates.Value.Add(update);
4016 } 4099 }
4017 } 4100 }
4018 4101
@@ -4023,6 +4106,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4023 SceneObjectPart sop = (SceneObjectPart)update.Entity; 4106 SceneObjectPart sop = (SceneObjectPart)update.Entity;
4024 ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop); 4107 ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop);
4025 objectPropertiesBlocks.Value.Add(objPropDB); 4108 objectPropertiesBlocks.Value.Add(objPropDB);
4109 propertyUpdates.Value.Add(update);
4026 } 4110 }
4027 } 4111 }
4028 4112
@@ -4030,12 +4114,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4030 } 4114 }
4031 4115
4032 4116
4033 Int32 ppcnt = 0; 4117 // Int32 ppcnt = 0;
4034 Int32 pbcnt = 0; 4118 // Int32 pbcnt = 0;
4035 4119
4036 if (objectPropertiesBlocks.IsValueCreated) 4120 if (objectPropertiesBlocks.IsValueCreated)
4037 { 4121 {
4038 List<ObjectPropertiesPacket.ObjectDataBlock> blocks = objectPropertiesBlocks.Value; 4122 List<ObjectPropertiesPacket.ObjectDataBlock> blocks = objectPropertiesBlocks.Value;
4123 List<ObjectPropertyUpdate> updates = propertyUpdates.Value;
4039 4124
4040 ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 4125 ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
4041 packet.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[blocks.Count]; 4126 packet.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[blocks.Count];
@@ -4043,28 +4128,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4043 packet.ObjectData[i] = blocks[i]; 4128 packet.ObjectData[i] = blocks[i];
4044 4129
4045 packet.Header.Zerocoded = true; 4130 packet.Header.Zerocoded = true;
4046 OutPacket(packet, ThrottleOutPacketType.Task, true);
4047 4131
4048 pbcnt += blocks.Count; 4132 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4049 ppcnt++; 4133 // of the object rather than the properties when the packet was created
4134 OutPacket(packet, ThrottleOutPacketType.Task, true,
4135 delegate(OutgoingPacket oPacket)
4136 {
4137 ResendPropertyUpdates(updates, oPacket);
4138 });
4139
4140 // pbcnt += blocks.Count;
4141 // ppcnt++;
4050 } 4142 }
4051 4143
4052 Int32 fpcnt = 0; 4144 // Int32 fpcnt = 0;
4053 Int32 fbcnt = 0; 4145 // Int32 fbcnt = 0;
4054 4146
4055 if (objectFamilyBlocks.IsValueCreated) 4147 if (objectFamilyBlocks.IsValueCreated)
4056 { 4148 {
4057 List<ObjectPropertiesFamilyPacket.ObjectDataBlock> blocks = objectFamilyBlocks.Value; 4149 List<ObjectPropertiesFamilyPacket.ObjectDataBlock> blocks = objectFamilyBlocks.Value;
4058 4150
4059 // ObjectPropertiesFamilyPacket objPropFamilyPack =
4060 // (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily);
4061 //
4062 // objPropFamilyPack.ObjectData = new ObjectPropertiesFamilyPacket.ObjectDataBlock[blocks.Count];
4063 // for (int i = 0; i < blocks.Count; i++)
4064 // objPropFamilyPack.ObjectData[i] = blocks[i];
4065 //
4066 // OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task, true);
4067
4068 // one packet per object block... uggh... 4151 // one packet per object block... uggh...
4069 for (int i = 0; i < blocks.Count; i++) 4152 for (int i = 0; i < blocks.Count; i++)
4070 { 4153 {
@@ -4073,10 +4156,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4073 4156
4074 packet.ObjectData = blocks[i]; 4157 packet.ObjectData = blocks[i];
4075 packet.Header.Zerocoded = true; 4158 packet.Header.Zerocoded = true;
4076 OutPacket(packet, ThrottleOutPacketType.Task);
4077 4159
4078 fpcnt++; 4160 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4079 fbcnt++; 4161 // of the object rather than the properties when the packet was created
4162 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4163 updates.Add(familyUpdates.Value[i]);
4164 OutPacket(packet, ThrottleOutPacketType.Task, true,
4165 delegate(OutgoingPacket oPacket)
4166 {
4167 ResendPropertyUpdates(updates, oPacket);
4168 });
4169
4170 // fpcnt++;
4171 // fbcnt++;
4080 } 4172 }
4081 4173
4082 } 4174 }
@@ -4113,7 +4205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4113 4205
4114 return block; 4206 return block;
4115 } 4207 }
4116 4208
4117 private ObjectPropertiesPacket.ObjectDataBlock CreateObjectPropertiesBlock(SceneObjectPart sop) 4209 private ObjectPropertiesPacket.ObjectDataBlock CreateObjectPropertiesBlock(SceneObjectPart sop)
4118 { 4210 {
4119 //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 4211 //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
@@ -4764,7 +4856,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4764 data.RelativePosition.ToBytes(objectData, 0); 4856 data.RelativePosition.ToBytes(objectData, 0);
4765 data.Velocity.ToBytes(objectData, 12); 4857 data.Velocity.ToBytes(objectData, 12);
4766 data.Acceleration.ToBytes(objectData, 24); 4858 data.Acceleration.ToBytes(objectData, 24);
4767 data.RotationOffset.ToBytes(objectData, 36); 4859 try
4860 {
4861 data.RotationOffset.ToBytes(objectData, 36);
4862 }
4863 catch (Exception e)
4864 {
4865 m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString());
4866 OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36);
4867 }
4768 data.AngularVelocity.ToBytes(objectData, 48); 4868 data.AngularVelocity.ToBytes(objectData, 48);
4769 4869
4770 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 4870 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
@@ -11328,7 +11428,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11328 /// <returns></returns> 11428 /// <returns></returns>
11329 public byte[] GetThrottlesPacked(float multiplier) 11429 public byte[] GetThrottlesPacked(float multiplier)
11330 { 11430 {
11331 return m_udpClient.GetThrottlesPacked(); 11431 return m_udpClient.GetThrottlesPacked(multiplier);
11332 } 11432 }
11333 11433
11334 /// <summary> 11434 /// <summary>
@@ -11363,6 +11463,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11363 /// handles splitting manually</param> 11463 /// handles splitting manually</param>
11364 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) 11464 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
11365 { 11465 {
11466 OutPacket(packet, throttlePacketType, doAutomaticSplitting, null);
11467 }
11468
11469 /// <summary>
11470 /// This is the starting point for sending a simulator packet out to the client
11471 /// </summary>
11472 /// <param name="packet">Packet to send</param>
11473 /// <param name="throttlePacketType">Throttling category for the packet</param>
11474 /// <param name="doAutomaticSplitting">True to automatically split oversized
11475 /// packets (the default), or false to disable splitting if the calling code
11476 /// handles splitting manually</param>
11477 /// <param name="method">The method to be called in the event this packet is reliable
11478 /// and unacknowledged. The server will provide normal resend capability if you do not
11479 /// provide your own method.</param>
11480 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method)
11481 {
11366 if (m_debugPacketLevel > 0) 11482 if (m_debugPacketLevel > 0)
11367 { 11483 {
11368 bool logPacket = true; 11484 bool logPacket = true;
@@ -11388,7 +11504,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11388 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); 11504 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
11389 } 11505 }
11390 11506
11391 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); 11507 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method);
11392 } 11508 }
11393 11509
11394 public bool AddMoney(int debit) 11510 public bool AddMoney(int debit)
@@ -11519,7 +11635,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11519 11635
11520 info.userEP = m_userEndPoint; 11636 info.userEP = m_userEndPoint;
11521 info.proxyEP = null; 11637 info.proxyEP = null;
11522 info.agentcircuit = new sAgentCircuitData(RequestClientInfo()); 11638 info.agentcircuit = RequestClientInfo();
11523 11639
11524 return info; 11640 return info;
11525 } 11641 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 7be8a0a..ca5501d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -135,7 +135,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
135 private int m_nextOnQueueEmpty = 1; 135 private int m_nextOnQueueEmpty = 1;
136 136
137 /// <summary>Throttle bucket for this agent's connection</summary> 137 /// <summary>Throttle bucket for this agent's connection</summary>
138 private readonly TokenBucket m_throttleClient; 138 private readonly AdaptiveTokenBucket m_throttleClient;
139 public AdaptiveTokenBucket FlowThrottle
140 {
141 get { return m_throttleClient; }
142 }
143
139 /// <summary>Throttle bucket for this agent's connection</summary> 144 /// <summary>Throttle bucket for this agent's connection</summary>
140 private readonly TokenBucket m_throttleCategory; 145 private readonly TokenBucket m_throttleCategory;
141 /// <summary>Throttle buckets for each packet category</summary> 146 /// <summary>Throttle buckets for each packet category</summary>
@@ -176,9 +181,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
176 m_maxRTO = maxRTO; 181 m_maxRTO = maxRTO;
177 182
178 // Create a token bucket throttle for this client that has the scene token bucket as a parent 183 // Create a token bucket throttle for this client that has the scene token bucket as a parent
179 m_throttleClient = new TokenBucket(parentThrottle, rates.TotalLimit); 184 m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled);
180 // Create a token bucket throttle for the total categary with the client bucket as a throttle 185 // Create a token bucket throttle for the total categary with the client bucket as a throttle
181 m_throttleCategory = new TokenBucket(m_throttleClient, rates.TotalLimit); 186 m_throttleCategory = new TokenBucket(m_throttleClient, 0);
182 // Create an array of token buckets for this clients different throttle categories 187 // Create an array of token buckets for this clients different throttle categories
183 m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; 188 m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
184 189
@@ -189,7 +194,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
189 // Initialize the packet outboxes, where packets sit while they are waiting for tokens 194 // Initialize the packet outboxes, where packets sit while they are waiting for tokens
190 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); 195 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
191 // Initialize the token buckets that control the throttling for each category 196 // Initialize the token buckets that control the throttling for each category
192 m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetLimit(type)); 197 m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type));
193 } 198 }
194 199
195 // Default the retransmission timeout to three seconds 200 // Default the retransmission timeout to three seconds
@@ -223,26 +228,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
223 /// <returns>Information about the client connection</returns> 228 /// <returns>Information about the client connection</returns>
224 public ClientInfo GetClientInfo() 229 public ClientInfo GetClientInfo()
225 { 230 {
226///<mic>
227 TokenBucket tb;
228
229 tb = m_throttleClient.Parent;
230 m_log.WarnFormat("[TOKENS] {3}: Actual={0},Request={1},TotalRequest={2}",tb.DripRate,tb.RequestedDripRate,tb.TotalDripRequest,"ROOT");
231
232 tb = m_throttleClient;
233 m_log.WarnFormat("[TOKENS] {3}: Actual={0},Request={1},TotalRequest={2}",tb.DripRate,tb.RequestedDripRate,tb.TotalDripRequest," CLIENT");
234
235 tb = m_throttleCategory;
236 m_log.WarnFormat("[TOKENS] {3}: Actual={0},Request={1},TotalRequest={2}",tb.DripRate,tb.RequestedDripRate,tb.TotalDripRequest," CATEGORY");
237
238 for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
239 {
240 tb = m_throttleCategories[i];
241 m_log.WarnFormat("[TOKENS] {4} <{0}:{1}>: Actual={2},Requested={3}",AgentID,i,tb.DripRate,tb.RequestedDripRate," BUCKET");
242 }
243
244///</mic>
245
246 // TODO: This data structure is wrong in so many ways. Locking and copying the entire lists 231 // TODO: This data structure is wrong in so many ways. Locking and copying the entire lists
247 // of pending and needed ACKs for every client every time some method wants information about 232 // of pending and needed ACKs for every client every time some method wants information about
248 // this connection is a recipe for poor performance 233 // this connection is a recipe for poor performance
@@ -254,12 +239,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
254 info.landThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate; 239 info.landThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate;
255 info.windThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate; 240 info.windThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate;
256 info.cloudThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate; 241 info.cloudThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate;
257 // info.taskThrottle = m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate + m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate;
258 info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; 242 info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate;
259 info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; 243 info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
260 info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; 244 info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
261 info.totalThrottle = info.resendThrottle + info.landThrottle + info.windThrottle + info.cloudThrottle + 245 info.totalThrottle = (int)m_throttleCategory.DripRate;
262 info.taskThrottle + info.assetThrottle + info.textureThrottle;
263 246
264 return info; 247 return info;
265 } 248 }
@@ -346,8 +329,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
346 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); 329 int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
347 // State is a subcategory of task that we allocate a percentage to 330 // State is a subcategory of task that we allocate a percentage to
348 int state = 0; 331 int state = 0;
349 // int state = (int)((float)task * STATE_TASK_PERCENTAGE);
350 // task -= state;
351 332
352 // Make sure none of the throttles are set below our packet MTU, 333 // Make sure none of the throttles are set below our packet MTU,
353 // otherwise a throttle could become permanently clogged 334 // otherwise a throttle could become permanently clogged
@@ -358,19 +339,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
358 task = Math.Max(task, LLUDPServer.MTU); 339 task = Math.Max(task, LLUDPServer.MTU);
359 texture = Math.Max(texture, LLUDPServer.MTU); 340 texture = Math.Max(texture, LLUDPServer.MTU);
360 asset = Math.Max(asset, LLUDPServer.MTU); 341 asset = Math.Max(asset, LLUDPServer.MTU);
361 state = Math.Max(state, LLUDPServer.MTU);
362
363 int total = resend + land + wind + cloud + task + texture + asset + state;
364 342
365 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, State={8}, Total={9}", 343 //int total = resend + land + wind + cloud + task + texture + asset;
366 // AgentID, resend, land, wind, cloud, task, texture, asset, state, total); 344 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}",
345 // AgentID, resend, land, wind, cloud, task, texture, asset, total);
367 346
368 // Update the token buckets with new throttle values 347 // Update the token buckets with new throttle values
369 TokenBucket bucket; 348 TokenBucket bucket;
370 349
371 bucket = m_throttleCategory;
372 bucket.RequestedDripRate = total;
373
374 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; 350 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
375 bucket.RequestedDripRate = resend; 351 bucket.RequestedDripRate = resend;
376 352
@@ -399,22 +375,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
399 m_packedThrottles = null; 375 m_packedThrottles = null;
400 } 376 }
401 377
402 public byte[] GetThrottlesPacked() 378 public byte[] GetThrottlesPacked(float multiplier)
403 { 379 {
404 byte[] data = m_packedThrottles; 380 byte[] data = m_packedThrottles;
405 381
406 if (data == null) 382 if (data == null)
407 { 383 {
384 float rate;
385
408 data = new byte[7 * 4]; 386 data = new byte[7 * 4];
409 int i = 0; 387 int i = 0;
410 388
411 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate), 0, data, i, 4); i += 4; 389 // multiply by 8 to convert bytes back to bits
412 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate), 0, data, i, 4); i += 4; 390 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate * 8 * multiplier;
413 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate), 0, data, i, 4); i += 4; 391 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
414 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate), 0, data, i, 4); i += 4; 392
415 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate), 0, data, i, 4); i += 4; 393 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate * 8 * multiplier;
416 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate), 0, data, i, 4); i += 4; 394 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
417 Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate), 0, data, i, 4); i += 4; 395
396 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate * 8 * multiplier;
397 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
398
399 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate * 8 * multiplier;
400 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
401
402 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate * 8 * multiplier;
403 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
404
405 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate * 8 * multiplier;
406 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
407
408 rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate * 8 * multiplier;
409 Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4;
418 410
419 m_packedThrottles = data; 411 m_packedThrottles = data;
420 } 412 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index d08b25f..aff90c5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -297,7 +297,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
297 delegate(IClientAPI client) 297 delegate(IClientAPI client)
298 { 298 {
299 if (client is LLClientView) 299 if (client is LLClientView)
300 SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category); 300 SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
301 } 301 }
302 ); 302 );
303 } 303 }
@@ -309,7 +309,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
309 delegate(IClientAPI client) 309 delegate(IClientAPI client)
310 { 310 {
311 if (client is LLClientView) 311 if (client is LLClientView)
312 SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category); 312 SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
313 } 313 }
314 ); 314 );
315 } 315 }
@@ -322,7 +322,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
322 /// <param name="packet"></param> 322 /// <param name="packet"></param>
323 /// <param name="category"></param> 323 /// <param name="category"></param>
324 /// <param name="allowSplitting"></param> 324 /// <param name="allowSplitting"></param>
325 public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting) 325 public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method)
326 { 326 {
327 // CoarseLocationUpdate packets cannot be split in an automated way 327 // CoarseLocationUpdate packets cannot be split in an automated way
328 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting) 328 if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
@@ -339,13 +339,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
339 for (int i = 0; i < packetCount; i++) 339 for (int i = 0; i < packetCount; i++)
340 { 340 {
341 byte[] data = datas[i]; 341 byte[] data = datas[i];
342 SendPacketData(udpClient, data, packet.Type, category); 342 SendPacketData(udpClient, data, packet.Type, category, method);
343 } 343 }
344 } 344 }
345 else 345 else
346 { 346 {
347 byte[] data = packet.ToBytes(); 347 byte[] data = packet.ToBytes();
348 SendPacketData(udpClient, data, packet.Type, category); 348 SendPacketData(udpClient, data, packet.Type, category, method);
349 } 349 }
350 } 350 }
351 351
@@ -356,7 +356,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
356 /// <param name="data"></param> 356 /// <param name="data"></param>
357 /// <param name="type"></param> 357 /// <param name="type"></param>
358 /// <param name="category"></param> 358 /// <param name="category"></param>
359 public void SendPacketData(LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category) 359 public void SendPacketData(LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category, UnackedPacketMethod method)
360 { 360 {
361 int dataLength = data.Length; 361 int dataLength = data.Length;
362 bool doZerocode = (data[0] & Helpers.MSG_ZEROCODED) != 0; 362 bool doZerocode = (data[0] & Helpers.MSG_ZEROCODED) != 0;
@@ -411,7 +411,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
411 411
412 #region Queue or Send 412 #region Queue or Send
413 413
414 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); 414 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
415 // If we were not provided a method for handling unacked, use the UDPServer default method
416 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
415 417
416 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will 418 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
417 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 419 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
@@ -445,7 +447,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
445 packet.Header.Reliable = false; 447 packet.Header.Reliable = false;
446 packet.Packets = blocks.ToArray(); 448 packet.Packets = blocks.ToArray();
447 449
448 SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true); 450 SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true, null);
449 } 451 }
450 } 452 }
451 453
@@ -458,17 +460,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
458 // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit 460 // We *could* get OldestUnacked, but it would hurt performance and not provide any benefit
459 pc.PingID.OldestUnacked = 0; 461 pc.PingID.OldestUnacked = 0;
460 462
461 SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false); 463 SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null);
462 } 464 }
463 465
464 public void CompletePing(LLUDPClient udpClient, byte pingID) 466 public void CompletePing(LLUDPClient udpClient, byte pingID)
465 { 467 {
466 CompletePingCheckPacket completePing = new CompletePingCheckPacket(); 468 CompletePingCheckPacket completePing = new CompletePingCheckPacket();
467 completePing.PingID.PingID = pingID; 469 completePing.PingID.PingID = pingID;
468 SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false); 470 SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false, null);
469 } 471 }
470 472
471 public void ResendUnacked(LLUDPClient udpClient) 473 public void HandleUnacked(LLUDPClient udpClient)
472 { 474 {
473 if (!udpClient.IsConnected) 475 if (!udpClient.IsConnected)
474 return; 476 return;
@@ -488,31 +490,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
488 490
489 if (expiredPackets != null) 491 if (expiredPackets != null)
490 { 492 {
491 //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); 493 //m_log.Debug("[LLUDPSERVER]: Handling " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO);
492
493 // Exponential backoff of the retransmission timeout 494 // Exponential backoff of the retransmission timeout
494 udpClient.BackoffRTO(); 495 udpClient.BackoffRTO();
496 for (int i = 0; i < expiredPackets.Count; ++i)
497 expiredPackets[i].UnackedMethod(expiredPackets[i]);
498 }
499 }
495 500
496 // Resend packets 501 public void ResendUnacked(OutgoingPacket outgoingPacket)
497 for (int i = 0; i < expiredPackets.Count; i++) 502 {
498 { 503 //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
499 OutgoingPacket outgoingPacket = expiredPackets[i]; 504 // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);
500
501 //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed",
502 // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount);
503 505
504 // Set the resent flag 506 // Set the resent flag
505 outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT); 507 outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT);
506 outgoingPacket.Category = ThrottleOutPacketType.Resend; 508 outgoingPacket.Category = ThrottleOutPacketType.Resend;
507 509
508 // Bump up the resend count on this packet 510 // Bump up the resend count on this packet
509 Interlocked.Increment(ref outgoingPacket.ResendCount); 511 Interlocked.Increment(ref outgoingPacket.ResendCount);
510 512
511 // Requeue or resend the packet 513 // Requeue or resend the packet
512 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) 514 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false))
513 SendPacketFinal(outgoingPacket); 515 SendPacketFinal(outgoingPacket);
514 }
515 }
516 } 516 }
517 517
518 public void Flush(LLUDPClient udpClient) 518 public void Flush(LLUDPClient udpClient)
@@ -672,7 +672,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
672 if (packet.Header.AppendedAcks && packet.Header.AckList != null) 672 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
673 { 673 {
674 for (int i = 0; i < packet.Header.AckList.Length; i++) 674 for (int i = 0; i < packet.Header.AckList.Length; i++)
675 udpClient.NeedAcks.Remove(packet.Header.AckList[i], now, packet.Header.Resent); 675 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent);
676 } 676 }
677 677
678 // Handle PacketAck packets 678 // Handle PacketAck packets
@@ -681,7 +681,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
681 PacketAckPacket ackPacket = (PacketAckPacket)packet; 681 PacketAckPacket ackPacket = (PacketAckPacket)packet;
682 682
683 for (int i = 0; i < ackPacket.Packets.Length; i++) 683 for (int i = 0; i < ackPacket.Packets.Length; i++)
684 udpClient.NeedAcks.Remove(ackPacket.Packets[i].ID, now, packet.Header.Resent); 684 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent);
685 685
686 // We don't need to do anything else with PacketAck packets 686 // We don't need to do anything else with PacketAck packets
687 return; 687 return;
@@ -1096,7 +1096,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1096 if (udpClient.IsConnected) 1096 if (udpClient.IsConnected)
1097 { 1097 {
1098 if (m_resendUnacked) 1098 if (m_resendUnacked)
1099 ResendUnacked(udpClient); 1099 HandleUnacked(udpClient);
1100 1100
1101 if (m_sendAcks) 1101 if (m_sendAcks)
1102 SendAcks(udpClient); 1102 SendAcks(udpClient);
@@ -1152,7 +1152,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1152 nticksUnack++; 1152 nticksUnack++;
1153 watch2.Start(); 1153 watch2.Start();
1154 1154
1155 ResendUnacked(udpClient); 1155 HandleUnacked(udpClient);
1156 1156
1157 watch2.Stop(); 1157 watch2.Stop();
1158 avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack); 1158 avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
index 1a1a1cb..76c6c14 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
@@ -31,6 +31,8 @@ using OpenMetaverse;
31 31
32namespace OpenSim.Region.ClientStack.LindenUDP 32namespace OpenSim.Region.ClientStack.LindenUDP
33{ 33{
34
35 public delegate void UnackedPacketMethod(OutgoingPacket oPacket);
34 /// <summary> 36 /// <summary>
35 /// Holds a reference to the <seealso cref="LLUDPClient"/> this packet is 37 /// Holds a reference to the <seealso cref="LLUDPClient"/> this packet is
36 /// destined for, along with the serialized packet data, sequence number 38 /// destined for, along with the serialized packet data, sequence number
@@ -52,6 +54,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
52 public int TickCount; 54 public int TickCount;
53 /// <summary>Category this packet belongs to</summary> 55 /// <summary>Category this packet belongs to</summary>
54 public ThrottleOutPacketType Category; 56 public ThrottleOutPacketType Category;
57 /// <summary>The delegate to be called if this packet is determined to be unacknowledged</summary>
58 public UnackedPacketMethod UnackedMethod;
55 59
56 /// <summary> 60 /// <summary>
57 /// Default constructor 61 /// Default constructor
@@ -60,11 +64,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
60 /// <param name="buffer">Serialized packet data. If the flags or sequence number 64 /// <param name="buffer">Serialized packet data. If the flags or sequence number
61 /// need to be updated, they will be injected directly into this binary buffer</param> 65 /// need to be updated, they will be injected directly into this binary buffer</param>
62 /// <param name="category">Throttling category for this packet</param> 66 /// <param name="category">Throttling category for this packet</param>
63 public OutgoingPacket(LLUDPClient client, UDPPacketBuffer buffer, ThrottleOutPacketType category) 67 public OutgoingPacket(LLUDPClient client, UDPPacketBuffer buffer, ThrottleOutPacketType category, UnackedPacketMethod method)
64 { 68 {
65 Client = client; 69 Client = client;
66 Buffer = buffer; 70 Buffer = buffer;
67 Category = category; 71 Category = category;
72 UnackedMethod = method;
68 } 73 }
69 } 74 }
70} 75}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs
index aaf6e26..c9aac0b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs
@@ -52,30 +52,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
52 public int Texture; 52 public int Texture;
53 /// <summary>Drip rate for asset packets</summary> 53 /// <summary>Drip rate for asset packets</summary>
54 public int Asset; 54 public int Asset;
55 /// <summary>Drip rate for state packets</summary> 55
56 public int State;
57 /// <summary>Drip rate for the parent token bucket</summary> 56 /// <summary>Drip rate for the parent token bucket</summary>
58 public int Total; 57 public int Total;
59 58
60 /// <summary>Maximum burst rate for resent packets</summary> 59 /// <summary>Flag used to enable adaptive throttles</summary>
61 public int ResendLimit; 60 public bool AdaptiveThrottlesEnabled;
62 /// <summary>Maximum burst rate for land packets</summary> 61
63 public int LandLimit;
64 /// <summary>Maximum burst rate for wind packets</summary>
65 public int WindLimit;
66 /// <summary>Maximum burst rate for cloud packets</summary>
67 public int CloudLimit;
68 /// <summary>Maximum burst rate for task (state and transaction) packets</summary>
69 public int TaskLimit;
70 /// <summary>Maximum burst rate for texture packets</summary>
71 public int TextureLimit;
72 /// <summary>Maximum burst rate for asset packets</summary>
73 public int AssetLimit;
74 /// <summary>Maximum burst rate for state packets</summary>
75 public int StateLimit;
76 /// <summary>Burst rate for the parent token bucket</summary>
77 public int TotalLimit;
78
79 /// <summary> 62 /// <summary>
80 /// Default constructor 63 /// Default constructor
81 /// </summary> 64 /// </summary>
@@ -86,26 +69,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
86 { 69 {
87 IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; 70 IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"];
88 71
89 Resend = throttleConfig.GetInt("resend_default", 12500); 72 Resend = throttleConfig.GetInt("resend_default", 6625);
90 Land = throttleConfig.GetInt("land_default", 1000); 73 Land = throttleConfig.GetInt("land_default", 9125);
91 Wind = throttleConfig.GetInt("wind_default", 1000); 74 Wind = throttleConfig.GetInt("wind_default", 1750);
92 Cloud = throttleConfig.GetInt("cloud_default", 1000); 75 Cloud = throttleConfig.GetInt("cloud_default", 1750);
93 Task = throttleConfig.GetInt("task_default", 1000); 76 Task = throttleConfig.GetInt("task_default", 18500);
94 Texture = throttleConfig.GetInt("texture_default", 1000); 77 Texture = throttleConfig.GetInt("texture_default", 18500);
95 Asset = throttleConfig.GetInt("asset_default", 1000); 78 Asset = throttleConfig.GetInt("asset_default", 10500);
96 State = throttleConfig.GetInt("state_default", 1000);
97
98 ResendLimit = throttleConfig.GetInt("resend_limit", 18750);
99 LandLimit = throttleConfig.GetInt("land_limit", 29750);
100 WindLimit = throttleConfig.GetInt("wind_limit", 18750);
101 CloudLimit = throttleConfig.GetInt("cloud_limit", 18750);
102 TaskLimit = throttleConfig.GetInt("task_limit", 18750);
103 TextureLimit = throttleConfig.GetInt("texture_limit", 55750);
104 AssetLimit = throttleConfig.GetInt("asset_limit", 27500);
105 StateLimit = throttleConfig.GetInt("state_limit", 37000);
106 79
107 Total = throttleConfig.GetInt("client_throttle_max_bps", 0); 80 Total = throttleConfig.GetInt("client_throttle_max_bps", 0);
108 TotalLimit = Total; 81
82 AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
109 } 83 }
110 catch (Exception) { } 84 catch (Exception) { }
111 } 85 }
@@ -128,34 +102,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
128 return Texture; 102 return Texture;
129 case ThrottleOutPacketType.Asset: 103 case ThrottleOutPacketType.Asset:
130 return Asset; 104 return Asset;
131 case ThrottleOutPacketType.State:
132 return State;
133 case ThrottleOutPacketType.Unknown:
134 default:
135 return 0;
136 }
137 }
138
139 public int GetLimit(ThrottleOutPacketType type)
140 {
141 switch (type)
142 {
143 case ThrottleOutPacketType.Resend:
144 return ResendLimit;
145 case ThrottleOutPacketType.Land:
146 return LandLimit;
147 case ThrottleOutPacketType.Wind:
148 return WindLimit;
149 case ThrottleOutPacketType.Cloud:
150 return CloudLimit;
151 case ThrottleOutPacketType.Task:
152 return TaskLimit;
153 case ThrottleOutPacketType.Texture:
154 return TextureLimit;
155 case ThrottleOutPacketType.Asset:
156 return AssetLimit;
157 case ThrottleOutPacketType.State:
158 return StateLimit;
159 case ThrottleOutPacketType.Unknown: 105 case ThrottleOutPacketType.Unknown:
160 default: 106 default:
161 return 0; 107 return 0;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
index 07b0a1d..29fd1a4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs
@@ -29,6 +29,8 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework;
33
32using log4net; 34using log4net;
33 35
34namespace OpenSim.Region.ClientStack.LindenUDP 36namespace OpenSim.Region.ClientStack.LindenUDP
@@ -48,31 +50,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
48 /// Number of ticks (ms) per quantum, drip rate and max burst 50 /// Number of ticks (ms) per quantum, drip rate and max burst
49 /// are defined over this interval. 51 /// are defined over this interval.
50 /// </summary> 52 /// </summary>
51 private const Int32 m_ticksPerQuantum = 1000; 53 protected const Int32 m_ticksPerQuantum = 1000;
52 54
53 /// <summary> 55 /// <summary>
54 /// This is the number of quantums worth of packets that can 56 /// This is the number of quantums worth of packets that can
55 /// be accommodated during a burst 57 /// be accommodated during a burst
56 /// </summary> 58 /// </summary>
57 private const Double m_quantumsPerBurst = 1.5; 59 protected const Double m_quantumsPerBurst = 1.5;
58 60
59 /// <summary> 61 /// <summary>
60 /// </summary> 62 /// </summary>
61 private const Int32 m_minimumDripRate = 1400; 63 protected const Int32 m_minimumDripRate = 1400;
62 64
63 /// <summary>Time of the last drip, in system ticks</summary> 65 /// <summary>Time of the last drip, in system ticks</summary>
64 private Int32 m_lastDrip; 66 protected Int32 m_lastDrip;
65 67
66 /// <summary> 68 /// <summary>
67 /// The number of bytes that can be sent at this moment. This is the 69 /// The number of bytes that can be sent at this moment. This is the
68 /// current number of tokens in the bucket 70 /// current number of tokens in the bucket
69 /// </summary> 71 /// </summary>
70 private Int64 m_tokenCount; 72 protected Int64 m_tokenCount;
71 73
72 /// <summary> 74 /// <summary>
73 /// Map of children buckets and their requested maximum burst rate 75 /// Map of children buckets and their requested maximum burst rate
74 /// </summary> 76 /// </summary>
75 private Dictionary<TokenBucket,Int64> m_children = new Dictionary<TokenBucket,Int64>(); 77 protected Dictionary<TokenBucket,Int64> m_children = new Dictionary<TokenBucket,Int64>();
76 78
77#region Properties 79#region Properties
78 80
@@ -81,7 +83,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
81 /// parent. The parent bucket will limit the aggregate bandwidth of all 83 /// parent. The parent bucket will limit the aggregate bandwidth of all
82 /// of its children buckets 84 /// of its children buckets
83 /// </summary> 85 /// </summary>
84 private TokenBucket m_parent; 86 protected TokenBucket m_parent;
85 public TokenBucket Parent 87 public TokenBucket Parent
86 { 88 {
87 get { return m_parent; } 89 get { return m_parent; }
@@ -93,7 +95,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
93 /// of tokens that can accumulate in the bucket at any one time. This 95 /// of tokens that can accumulate in the bucket at any one time. This
94 /// also sets the total request for leaf nodes 96 /// also sets the total request for leaf nodes
95 /// </summary> 97 /// </summary>
96 private Int64 m_burstRate; 98 protected Int64 m_burstRate;
97 public Int64 RequestedBurstRate 99 public Int64 RequestedBurstRate
98 { 100 {
99 get { return m_burstRate; } 101 get { return m_burstRate; }
@@ -118,8 +120,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
118 /// <remarks>Tokens are added to the bucket any time 120 /// <remarks>Tokens are added to the bucket any time
119 /// <seealso cref="RemoveTokens"/> is called, at the granularity of 121 /// <seealso cref="RemoveTokens"/> is called, at the granularity of
120 /// the system tick interval (typically around 15-22ms)</remarks> 122 /// the system tick interval (typically around 15-22ms)</remarks>
121 private Int64 m_dripRate; 123 protected Int64 m_dripRate;
122 public Int64 RequestedDripRate 124 public virtual Int64 RequestedDripRate
123 { 125 {
124 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } 126 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); }
125 set { 127 set {
@@ -131,7 +133,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
131 } 133 }
132 } 134 }
133 135
134 public Int64 DripRate 136 public virtual Int64 DripRate
135 { 137 {
136 get { 138 get {
137 if (m_parent == null) 139 if (m_parent == null)
@@ -149,7 +151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
149 /// The current total of the requested maximum burst rates of 151 /// The current total of the requested maximum burst rates of
150 /// this bucket's children buckets. 152 /// this bucket's children buckets.
151 /// </summary> 153 /// </summary>
152 private Int64 m_totalDripRequest; 154 protected Int64 m_totalDripRequest;
153 public Int64 TotalDripRequest 155 public Int64 TotalDripRequest
154 { 156 {
155 get { return m_totalDripRequest; } 157 get { return m_totalDripRequest; }
@@ -177,7 +179,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
177 RequestedDripRate = dripRate; 179 RequestedDripRate = dripRate;
178 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers 180 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers
179 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); 181 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
180 m_lastDrip = Environment.TickCount & Int32.MaxValue; 182 m_lastDrip = Util.EnvironmentTickCount();
181 } 183 }
182 184
183#endregion Constructor 185#endregion Constructor
@@ -189,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
189 /// hierarchy. However, if any of the parents is over-booked, then 191 /// hierarchy. However, if any of the parents is over-booked, then
190 /// the modifier will be less than 1. 192 /// the modifier will be less than 1.
191 /// </summary> 193 /// </summary>
192 private double DripRateModifier() 194 protected double DripRateModifier()
193 { 195 {
194 Int64 driprate = DripRate; 196 Int64 driprate = DripRate;
195 return driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest; 197 return driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest;
@@ -197,7 +199,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
197 199
198 /// <summary> 200 /// <summary>
199 /// </summary> 201 /// </summary>
200 private double BurstRateModifier() 202 protected double BurstRateModifier()
201 { 203 {
202 // for now... burst rate is always m_quantumsPerBurst (constant) 204 // for now... burst rate is always m_quantumsPerBurst (constant)
203 // larger than drip rate so the ratio of burst requests is the 205 // larger than drip rate so the ratio of burst requests is the
@@ -211,12 +213,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
211 /// </summary> 213 /// </summary>
212 public void RegisterRequest(TokenBucket child, Int64 request) 214 public void RegisterRequest(TokenBucket child, Int64 request)
213 { 215 {
214 m_children[child] = request; 216 lock (m_children)
215 // m_totalDripRequest = m_children.Values.Sum(); 217 {
218 m_children[child] = request;
219 // m_totalDripRequest = m_children.Values.Sum();
216 220
217 m_totalDripRequest = 0; 221 m_totalDripRequest = 0;
218 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children) 222 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
219 m_totalDripRequest += cref.Value; 223 m_totalDripRequest += cref.Value;
224 }
220 225
221 // Pass the new values up to the parent 226 // Pass the new values up to the parent
222 if (m_parent != null) 227 if (m_parent != null)
@@ -229,12 +234,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
229 /// </summary> 234 /// </summary>
230 public void UnregisterRequest(TokenBucket child) 235 public void UnregisterRequest(TokenBucket child)
231 { 236 {
232 m_children.Remove(child); 237 lock (m_children)
233 // m_totalDripRequest = m_children.Values.Sum(); 238 {
239 m_children.Remove(child);
240 // m_totalDripRequest = m_children.Values.Sum();
234 241
235 m_totalDripRequest = 0; 242 m_totalDripRequest = 0;
236 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children) 243 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
237 m_totalDripRequest += cref.Value; 244 m_totalDripRequest += cref.Value;
245 }
246
238 247
239 // Pass the new values up to the parent 248 // Pass the new values up to the parent
240 if (m_parent != null) 249 if (m_parent != null)
@@ -268,7 +277,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
268 /// Deposit tokens into the bucket from a child bucket that did 277 /// Deposit tokens into the bucket from a child bucket that did
269 /// not use all of its available tokens 278 /// not use all of its available tokens
270 /// </summary> 279 /// </summary>
271 private void Deposit(Int64 count) 280 protected void Deposit(Int64 count)
272 { 281 {
273 m_tokenCount += count; 282 m_tokenCount += count;
274 283
@@ -285,7 +294,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
285 /// call to Drip 294 /// call to Drip
286 /// </summary> 295 /// </summary>
287 /// <returns>True if tokens were added to the bucket, otherwise false</returns> 296 /// <returns>True if tokens were added to the bucket, otherwise false</returns>
288 private void Drip() 297 protected void Drip()
289 { 298 {
290 // This should never happen... means we are a leaf node and were created 299 // This should never happen... means we are a leaf node and were created
291 // with no drip rate... 300 // with no drip rate...
@@ -297,10 +306,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
297 306
298 // Determine the interval over which we are adding tokens, never add 307 // Determine the interval over which we are adding tokens, never add
299 // more than a single quantum of tokens 308 // more than a single quantum of tokens
300 Int32 now = Environment.TickCount & Int32.MaxValue; 309 Int32 deltaMS = Math.Min(Util.EnvironmentTickCountSubtract(m_lastDrip), m_ticksPerQuantum);
301 Int32 deltaMS = Math.Min(now - m_lastDrip, m_ticksPerQuantum); 310 m_lastDrip = Util.EnvironmentTickCount();
302
303 m_lastDrip = now;
304 311
305 // This can be 0 in the very unusual case that the timer wrapped 312 // This can be 0 in the very unusual case that the timer wrapped
306 // It can be 0 if we try add tokens at a sub-tick rate 313 // It can be 0 if we try add tokens at a sub-tick rate
@@ -310,4 +317,77 @@ namespace OpenSim.Region.ClientStack.LindenUDP
310 Deposit(deltaMS * DripRate / m_ticksPerQuantum); 317 Deposit(deltaMS * DripRate / m_ticksPerQuantum);
311 } 318 }
312 } 319 }
320
321 public class AdaptiveTokenBucket : TokenBucket
322 {
323 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
324
325 /// <summary>
326 /// The minimum rate for flow control. Minimum drip rate is one
327 /// packet per second. Open the throttle to 15 packets per second
328 /// or about 160kbps.
329 /// </summary>
330 protected const Int64 m_minimumFlow = m_minimumDripRate * 15;
331
332 // <summary>
333 // The maximum rate for flow control. Drip rate can never be
334 // greater than this.
335 // </summary>
336 protected Int64 m_maxDripRate = 0;
337 protected Int64 MaxDripRate
338 {
339 get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); }
340 set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); }
341 }
342
343 private bool m_enabled = false;
344
345 // <summary>
346 //
347 // </summary>
348 public virtual Int64 AdjustedDripRate
349 {
350 get { return m_dripRate; }
351 set {
352 m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value,m_minimumFlow,MaxDripRate);
353 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
354 if (m_parent != null)
355 m_parent.RegisterRequest(this,m_dripRate);
356 }
357 }
358
359 // <summary>
360 //
361 // </summary>
362 public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate)
363 {
364 m_enabled = enabled;
365
366 if (m_enabled)
367 {
368 // m_log.DebugFormat("[TOKENBUCKET] Adaptive throttle enabled");
369 MaxDripRate = maxDripRate;
370 AdjustedDripRate = m_minimumFlow;
371 }
372 }
373
374 // <summary>
375 //
376 // </summary>
377 public void ExpirePackets(Int32 count)
378 {
379 // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count);
380 if (m_enabled)
381 AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count));
382 }
383
384 // <summary>
385 //
386 // </summary>
387 public void AcknowledgePackets(Int32 count)
388 {
389 if (m_enabled)
390 AdjustedDripRate = AdjustedDripRate + count;
391 }
392 }
313} 393}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index d195110..793aefe 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -65,7 +65,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
65 /// <summary>Holds packets that need to be added to the unacknowledged list</summary> 65 /// <summary>Holds packets that need to be added to the unacknowledged list</summary>
66 private LocklessQueue<OutgoingPacket> m_pendingAdds = new LocklessQueue<OutgoingPacket>(); 66 private LocklessQueue<OutgoingPacket> m_pendingAdds = new LocklessQueue<OutgoingPacket>();
67 /// <summary>Holds information about pending acknowledgements</summary> 67 /// <summary>Holds information about pending acknowledgements</summary>
68 private LocklessQueue<PendingAck> m_pendingRemoves = new LocklessQueue<PendingAck>(); 68 private LocklessQueue<PendingAck> m_pendingAcknowledgements = new LocklessQueue<PendingAck>();
69 /// <summary>Holds information about pending removals</summary>
70 private LocklessQueue<uint> m_pendingRemoves = new LocklessQueue<uint>();
69 71
70 /// <summary> 72 /// <summary>
71 /// Add an unacked packet to the collection 73 /// Add an unacked packet to the collection
@@ -83,15 +85,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
83 85
84 /// <summary> 86 /// <summary>
85 /// Marks a packet as acknowledged 87 /// Marks a packet as acknowledged
88 /// This method is used when an acknowledgement is received from the network for a previously
89 /// sent packet. Effects of removal this way are to update unacked byte count, adjust RTT
90 /// and increase throttle to the coresponding client.
86 /// </summary> 91 /// </summary>
87 /// <param name="sequenceNumber">Sequence number of the packet to 92 /// <param name="sequenceNumber">Sequence number of the packet to
88 /// acknowledge</param> 93 /// acknowledge</param>
89 /// <param name="currentTime">Current value of Environment.TickCount</param> 94 /// <param name="currentTime">Current value of Environment.TickCount</param>
90 /// <remarks>This does not immediately acknowledge the packet, it only 95 /// <remarks>This does not immediately acknowledge the packet, it only
91 /// queues the ack so it can be handled in a thread-safe way later</remarks> 96 /// queues the ack so it can be handled in a thread-safe way later</remarks>
92 public void Remove(uint sequenceNumber, int currentTime, bool fromResend) 97 public void Acknowledge(uint sequenceNumber, int currentTime, bool fromResend)
93 { 98 {
94 m_pendingRemoves.Enqueue(new PendingAck(sequenceNumber, currentTime, fromResend)); 99 m_pendingAcknowledgements.Enqueue(new PendingAck(sequenceNumber, currentTime, fromResend));
100 }
101
102 /// <summary>
103 /// Marks a packet as no longer needing acknowledgement without a received acknowledgement.
104 /// This method is called when a packet expires and we no longer need an acknowledgement.
105 /// When some reliable packet types expire, they are handled in a way other than simply
106 /// resending them. The only effect of removal this way is to update unacked byte count.
107 /// </summary>
108 /// <param name="sequenceNumber">Sequence number of the packet to
109 /// acknowledge</param>
110 /// <remarks>The does not immediately remove the packet, it only queues the removal
111 /// so it can be handled in a thread safe way later</remarks>
112 public void Remove(uint sequenceNumber)
113 {
114 m_pendingRemoves.Enqueue(sequenceNumber);
95 } 115 }
96 116
97 /// <summary> 117 /// <summary>
@@ -130,6 +150,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
130 // is actually sent out again 150 // is actually sent out again
131 packet.TickCount = 0; 151 packet.TickCount = 0;
132 152
153 // As with other network applications, assume that an expired packet is
154 // an indication of some network problem, slow transmission
155 packet.Client.FlowThrottle.ExpirePackets(1);
156
133 expiredPackets.Add(packet); 157 expiredPackets.Add(packet);
134 } 158 }
135 } 159 }
@@ -147,29 +171,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP
147 m_packets[pendingAdd.SequenceNumber] = pendingAdd; 171 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
148 172
149 // Process all the pending removes, including updating statistics and round-trip times 173 // Process all the pending removes, including updating statistics and round-trip times
150 PendingAck pendingRemove; 174 PendingAck pendingAcknowledgement;
151 OutgoingPacket ackedPacket; 175 while (m_pendingAcknowledgements.TryDequeue(out pendingAcknowledgement))
152 while (m_pendingRemoves.TryDequeue(out pendingRemove))
153 { 176 {
154 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 177 OutgoingPacket ackedPacket;
178 if (m_packets.TryGetValue(pendingAcknowledgement.SequenceNumber, out ackedPacket))
155 { 179 {
156 if (ackedPacket != null) 180 if (ackedPacket != null)
157 { 181 {
158 m_packets.Remove(pendingRemove.SequenceNumber); 182 m_packets.Remove(pendingAcknowledgement.SequenceNumber);
183
184 // As with other network applications, assume that an acknowledged packet is an
185 // indication that the network can handle a little more load, speed up the transmission
186 ackedPacket.Client.FlowThrottle.AcknowledgePackets(ackedPacket.Buffer.DataLength);
159 187
160 // Update stats 188 // Update stats
161 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); 189 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
162 190
163 if (!pendingRemove.FromResend) 191 if (!pendingAcknowledgement.FromResend)
164 { 192 {
165 // Calculate the round-trip time for this packet and its ACK 193 // Calculate the round-trip time for this packet and its ACK
166 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; 194 int rtt = pendingAcknowledgement.RemoveTime - ackedPacket.TickCount;
167 if (rtt > 0) 195 if (rtt > 0)
168 ackedPacket.Client.UpdateRoundTrip(rtt); 196 ackedPacket.Client.UpdateRoundTrip(rtt);
169 } 197 }
170 } 198 }
171 } 199 }
172 } 200 }
201
202 uint pendingRemove;
203 while(m_pendingRemoves.TryDequeue(out pendingRemove))
204 {
205 OutgoingPacket removedPacket;
206 if (m_packets.TryGetValue(pendingRemove, out removedPacket))
207 {
208 if (removedPacket != null)
209 {
210 m_packets.Remove(pendingRemove);
211
212 // Update stats
213 Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength);
214 }
215 }
216 }
173 } 217 }
174 } 218 }
175} \ No newline at end of file 219}
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 771038e..9d8082b 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -41,8 +41,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 /// </summary> 41 /// </summary>
42 public class AgentAssetTransactions 42 public class AgentAssetTransactions
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger( 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45// MethodBase.GetCurrentMethod().DeclaringType);
46 45
47 // Fields 46 // Fields
48 private bool m_dumpAssetsToFile; 47 private bool m_dumpAssetsToFile;
@@ -149,6 +148,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
149 148
150 if (asset != null) 149 if (asset != null)
151 { 150 {
151// m_log.DebugFormat(
152// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
153// item.Name, part.Name, transactionID);
154
152 asset.FullID = UUID.Random(); 155 asset.FullID = UUID.Random();
153 asset.Name = item.Name; 156 asset.Name = item.Name;
154 asset.Description = item.Description; 157 asset.Description = item.Description;
@@ -156,8 +159,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
156 item.AssetID = asset.FullID; 159 item.AssetID = asset.FullID;
157 160
158 m_Scene.AssetService.Store(asset); 161 m_Scene.AssetService.Store(asset);
159
160 part.Inventory.UpdateInventoryItem(item);
161 } 162 }
162 } 163 }
163 } 164 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
index deec444..fc1ddef 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetMeshModule.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
70 if (meshConfig == null) 70 if (meshConfig == null)
71 return; 71 return;
72 72
73 m_enabled = meshConfig.GetBoolean("ColladaMesh", true); 73 m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true);
74 } 74 }
75 75
76 public void AddRegion(Scene pScene) 76 public void AddRegion(Scene pScene)
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
index d651cb2..3d4c7b7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/NewFileAgentInventoryVariablePriceModule.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
72 if (meshConfig == null) 72 if (meshConfig == null)
73 return; 73 return;
74 74
75 m_enabled = meshConfig.GetBoolean("ColladaMesh", true); 75 m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true);
76 } 76 }
77 77
78 public void AddRegion(Scene pScene) 78 public void AddRegion(Scene pScene)
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index ff26264..520d794 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -562,14 +562,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
562 /// <param name="sp"></param> 562 /// <param name="sp"></param>
563 /// <param name="so"></param> 563 /// <param name="so"></param>
564 /// <param name="attachmentpoint"></param> 564 /// <param name="attachmentpoint"></param>
565 /// <param name="AttachOffset"></param> 565 /// <param name="attachOffset"></param>
566 /// <param name="silent"></param> 566 /// <param name="silent"></param>
567 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent) 567 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
568 { 568 {
569 // don't attach attachments to child agents
570 if (avatar.IsChildAgent) return;
571 569
572// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); 570 m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
571 attachmentpoint, attachOffset, so.RootPart.AttachedPos);
573 572
574 so.DetachFromBackup(); 573 so.DetachFromBackup();
575 574
@@ -590,8 +589,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
590 so.RootPart.PhysActor = null; 589 so.RootPart.PhysActor = null;
591 } 590 }
592 591
593 so.AbsolutePosition = AttachOffset; 592 so.AbsolutePosition = attachOffset;
594 so.RootPart.AttachedPos = AttachOffset; 593 so.RootPart.AttachedPos = attachOffset;
595 so.RootPart.IsAttachment = true; 594 so.RootPart.IsAttachment = true;
596 595
597 so.RootPart.SetParentLocalId(avatar.LocalId); 596 so.RootPart.SetParentLocalId(avatar.LocalId);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index c88be7d..1054785 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -285,11 +285,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
285 } 285 }
286 286
287 string reason; 287 string reason;
288 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) 288 string version;
289 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
289 { 290 {
290 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); 291 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
291 return; 292 return;
292 } 293 }
294 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
293 295
294 sp.ControllingClient.SendTeleportStart(teleportFlags); 296 sp.ControllingClient.SendTeleportStart(teleportFlags);
295 297
@@ -371,20 +373,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
371 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 373 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
372 } 374 }
373 375
374 // Expect avatar crossing is a heavy-duty function at the destination.
375 // That is where MakeRoot is called, which fetches appearance and inventory.
376 // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates.
377 //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
378 // position, false);
379
380 //{
381 // avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
382 // // We should close that agent we just created over at destination...
383 // List<ulong> lst = new List<ulong>();
384 // lst.Add(reg.RegionHandle);
385 // SendCloseChildAgentAsync(avatar.UUID, lst);
386 // return;
387 //}
388 376
389 SetInTransit(sp.UUID); 377 SetInTransit(sp.UUID);
390 378
@@ -426,7 +414,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
426 414
427 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 415 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
428 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation 416 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
429 // that the client contacted the destination before we send the attachments and close things here. 417 // that the client contacted the destination before we close things here.
430 if (!WaitForCallback(sp.UUID)) 418 if (!WaitForCallback(sp.UUID))
431 { 419 {
432 m_log.WarnFormat( 420 m_log.WarnFormat(
@@ -437,14 +425,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
437 return; 425 return;
438 } 426 }
439 427
440 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 428 // For backwards compatibility
441 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 429 if (version == "Unknown" || version == string.Empty)
430 {
431 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
432 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
433 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
434 }
435
436 // May need to logout or other cleanup
437 AgentHasMovedAway(sp, logout);
442 438
443 // Well, this is it. The agent is over there. 439 // Well, this is it. The agent is over there.
444 KillEntity(sp.Scene, sp.LocalId); 440 KillEntity(sp.Scene, sp.LocalId);
445 441
446 // May need to logout or other cleanup
447 AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
448 442
449 // Now let's make it officially a child agent 443 // Now let's make it officially a child agent
450 sp.MakeChildAgent(); 444 sp.MakeChildAgent();
@@ -513,8 +507,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
513 507
514 } 508 }
515 509
516 protected virtual void AgentHasMovedAway(UUID sessionID, bool logout) 510 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
517 { 511 {
512 foreach (SceneObjectGroup sop in sp.Attachments)
513 {
514 sop.Scene.DeleteSceneObject(sop, true);
515 }
516 sp.Attachments.Clear();
518 } 517 }
519 518
520 protected void KillEntity(Scene scene, uint localID) 519 protected void KillEntity(Scene scene, uint localID)
@@ -784,7 +783,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
784 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 783 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
785 784
786 string reason; 785 string reason;
787 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) 786 string version;
787 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
788 { 788 {
789 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); 789 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
790 if (r == null) 790 if (r == null)
@@ -804,7 +804,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
804 agent.InTransit(); 804 agent.InTransit();
805 805
806 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; 806 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
807 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d); 807 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
808 808
809 return true; 809 return true;
810 } 810 }
@@ -861,17 +861,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
861 icon.EndInvoke(iar); 861 icon.EndInvoke(iar);
862 } 862 }
863 863
864 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying); 864 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
865 865
866 /// <summary> 866 /// <summary>
867 /// This Closes child agents on neighbouring regions 867 /// This Closes child agents on neighbouring regions
868 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 868 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
869 /// </summary> 869 /// </summary>
870 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying) 870 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version)
871 { 871 {
872 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 872 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
873 873
874 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); 874 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
875 875
876 Scene m_scene = agent.Scene; 876 Scene m_scene = agent.Scene;
877 877
@@ -945,7 +945,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
945 agent.SendOtherAgentsAvatarDataToMe(); 945 agent.SendOtherAgentsAvatarDataToMe();
946 agent.SendOtherAgentsAppearanceToMe(); 946 agent.SendOtherAgentsAppearanceToMe();
947 947
948 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); 948 // Backwards compatibility
949 if (version == "Unknown" || version == string.Empty)
950 {
951 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
952 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
953 }
954
955 AgentHasMovedAway(agent, false);
949 956
950 // the user may change their profile information in other region, 957 // the user may change their profile information in other region,
951 // so the userinfo in UserProfileCache is not reliable any more, delete it 958 // so the userinfo in UserProfileCache is not reliable any more, delete it
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 79e76b4..5c53f78 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -142,11 +142,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
142 return false; 142 return false;
143 } 143 }
144 144
145 protected override void AgentHasMovedAway(UUID sessionID, bool logout) 145 protected override void AgentHasMovedAway(ScenePresence sp, bool logout)
146 { 146 {
147 base.AgentHasMovedAway(sp, logout);
147 if (logout) 148 if (logout)
148 // Log them out of this grid 149 // Log them out of this grid
149 m_aScene.PresenceService.LogoutAgent(sessionID); 150 m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
150 } 151 }
151 152
152 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 153 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index c7244c8..6dd871f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -182,9 +182,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
182 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 182 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
183 { 183 {
184 InventoryCollection invCol = m_InventoryService.GetFolderContent(userID, folderID); 184 InventoryCollection invCol = m_InventoryService.GetFolderContent(userID, folderID);
185 if (UserManager != null) 185 Util.FireAndForget(delegate
186 foreach (InventoryItemBase item in invCol.Items) 186 {
187 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); 187 if (UserManager != null)
188 foreach (InventoryItemBase item in invCol.Items)
189 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData);
190 });
188 191
189 return invCol; 192 return invCol;
190 } 193 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index bd01bb9..8f1f257 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -46,10 +46,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private bool m_Enabled = false; 48 private bool m_Enabled = false;
49 private bool m_Initialized = false; 49 private Scene m_Scene;
50// private Scene m_Scene;
51 private XInventoryServicesConnector m_RemoteConnector; 50 private XInventoryServicesConnector m_RemoteConnector;
52 51
52 private IUserManagement m_UserManager;
53 private IUserManagement UserManager
54 {
55 get
56 {
57 if (m_UserManager == null)
58 {
59 m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>();
60 }
61 return m_UserManager;
62 }
63 }
64
53 public Type ReplaceableInterface 65 public Type ReplaceableInterface
54 { 66 {
55 get { return null; } 67 get { return null; }
@@ -114,12 +126,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
114 if (!m_Enabled) 126 if (!m_Enabled)
115 return; 127 return;
116 128
117 if (!m_Initialized)
118 {
119 m_Initialized = true;
120 }
121
122 scene.RegisterModuleInterface<IInventoryService>(this); 129 scene.RegisterModuleInterface<IInventoryService>(this);
130
131 if (m_Scene == null)
132 m_Scene = scene;
123 } 133 }
124 134
125 public void RemoveRegion(Scene scene) 135 public void RemoveRegion(Scene scene)
@@ -173,7 +183,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
173 183
174 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 184 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
175 { 185 {
176 return m_RemoteConnector.GetFolderContent(userID, folderID); 186 InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID);
187 Util.FireAndForget(delegate
188 {
189 if (UserManager != null)
190 foreach (InventoryItemBase item in invCol.Items)
191 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData);
192 });
193
194 return invCol;
177 } 195 }
178 196
179 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 197 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index a298b65..2cf02b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -41,6 +41,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService 41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 // Version of this service
45 private const string m_Version = "SIMULATION/0.1";
46
44 private List<Scene> m_sceneList = new List<Scene>(); 47 private List<Scene> m_sceneList = new List<Scene>();
45 48
46 private IEntityTransferModule m_AgentTransferModule; 49 private IEntityTransferModule m_AgentTransferModule;
@@ -257,9 +260,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
257 return false; 260 return false;
258 } 261 }
259 262
260 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 263 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
261 { 264 {
262 reason = "Communications failure"; 265 reason = "Communications failure";
266 version = m_Version;
263 if (destination == null) 267 if (destination == null)
264 return false; 268 return false;
265 269
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 67f4d60..7858f2a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -229,19 +229,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
229 229
230 } 230 }
231 231
232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
233 { 233 {
234 reason = "Communications failure"; 234 reason = "Communications failure";
235 version = "Unknown";
235 if (destination == null) 236 if (destination == null)
236 return false; 237 return false;
237 238
238 // Try local first 239 // Try local first
239 if (m_localBackend.QueryAccess(destination, id, position, out reason)) 240 if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
240 return true; 241 return true;
241 242
242 // else do the remote thing 243 // else do the remote thing
243 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 244 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
244 return m_remoteConnector.QueryAccess(destination, id, position, out reason); 245 return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
245 246
246 return false; 247 return false;
247 248
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index ab90e90..3aed6ba 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -125,7 +125,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
125 else 125 else
126 Scene.RegionInfo.RegionSettings.AllowLandResell = true; 126 Scene.RegionInfo.RegionSettings.AllowLandResell = true;
127 127
128 Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; 128 if((byte)maxAgents <= Scene.RegionInfo.AgentCapacity)
129 Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents;
130 else
131 Scene.RegionInfo.RegionSettings.AgentLimit = Scene.RegionInfo.AgentCapacity;
129 132
130 Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; 133 Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor;
131 134
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index e3ed905..4595a29 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes
119 119
120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) 120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
121 { 121 {
122 return 1; 122 // And anything attached to this avatar gets top priority as well
123 if (entity is SceneObjectPart)
124 {
125 SceneObjectPart sop = (SceneObjectPart)entity;
126 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
127 return 1;
128 }
129
130 return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues
123 } 131 }
124 132
125 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) 133 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
126 { 134 {
135 // And anything attached to this avatar gets top priority as well
136 if (entity is SceneObjectPart)
137 {
138 SceneObjectPart sop = (SceneObjectPart)entity;
139 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
140 return 1;
141 }
142
127 return ComputeDistancePriority(client,entity,false); 143 return ComputeDistancePriority(client,entity,false);
128 } 144 }
129 145
130 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) 146 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
131 { 147 {
148 // And anything attached to this avatar gets top priority as well
149 if (entity is SceneObjectPart)
150 {
151 SceneObjectPart sop = (SceneObjectPart)entity;
152 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
153 return 1;
154 }
155
132 return ComputeDistancePriority(client,entity,true); 156 return ComputeDistancePriority(client,entity,true);
133 } 157 }
134 158
@@ -141,18 +165,20 @@ namespace OpenSim.Region.Framework.Scenes
141 { 165 {
142 if (!presence.IsChildAgent) 166 if (!presence.IsChildAgent)
143 { 167 {
168 // All avatars other than our own go into pqueue 1
169 if (entity is ScenePresence)
170 return 1;
171
144 if (entity is SceneObjectPart) 172 if (entity is SceneObjectPart)
145 { 173 {
174 // Attachments are high priority,
175 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
176 return 1;
177
146 // Non physical prims are lower priority than physical prims 178 // Non physical prims are lower priority than physical prims
147 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; 179 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
148 if (physActor == null || !physActor.IsPhysical) 180 if (physActor == null || !physActor.IsPhysical)
149 pqueue++; 181 pqueue++;
150
151 // Attachments are high priority,
152 // MIC: shouldn't these already be in the highest priority queue already
153 // since their root position is same as the avatars?
154 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
155 pqueue = 1;
156 } 182 }
157 } 183 }
158 } 184 }
@@ -172,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes
172 198
173 // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); 199 // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
174 // throw new InvalidOperationException("Prioritization agent not defined"); 200 // throw new InvalidOperationException("Prioritization agent not defined");
175 return Int32.MaxValue; 201 return PriorityQueue.NumberOfQueues - 1;
176 } 202 }
177 203
178 // Use group position for child prims, since we are putting child prims in 204 // Use group position for child prims, since we are putting child prims in
@@ -197,8 +223,10 @@ namespace OpenSim.Region.Framework.Scenes
197 223
198 // And convert the distance to a priority queue, this computation gives queues 224 // And convert the distance to a priority queue, this computation gives queues
199 // at 10, 20, 40, 80, 160, 320, 640, and 1280m 225 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
200 uint pqueue = 1; 226 uint pqueue = PriorityQueue.NumberOfImmediateQueues;
201 for (int i = 0; i < 8; i++) 227 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
228
229 for (int i = 0; i < queues - 1; i++)
202 { 230 {
203 if (distance < 10 * Math.Pow(2.0,i)) 231 if (distance < 10 * Math.Pow(2.0,i))
204 break; 232 break;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0f85925..b0f0de6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1430,6 +1430,10 @@ namespace OpenSim.Region.Framework.Scenes
1430 } 1430 }
1431 else // Updating existing item with new perms etc 1431 else // Updating existing item with new perms etc
1432 { 1432 {
1433// m_log.DebugFormat(
1434// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
1435// currentItem.Name, part.Name);
1436
1433 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); 1437 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
1434 if (agentTransactions != null) 1438 if (agentTransactions != null)
1435 { 1439 {
@@ -2039,6 +2043,12 @@ namespace OpenSim.Region.Framework.Scenes
2039 if (rot != null) 2043 if (rot != null)
2040 group.UpdateGroupRotationR((Quaternion)rot); 2044 group.UpdateGroupRotationR((Quaternion)rot);
2041 2045
2046 // TODO: This needs to be refactored with the similar code in
2047 // SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
2048 // possibly by allowing this method to take a null rotation.
2049 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
2050 group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
2051
2042 // We can only call this after adding the scene object, since the scene object references the scene 2052 // We can only call this after adding the scene object, since the scene object references the scene
2043 // to find out if scripts should be activated at all. 2053 // to find out if scripts should be activated at all.
2044 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); 2054 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fdd5205..696c6ee 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2316,7 +2316,9 @@ namespace OpenSim.Region.Framework.Scenes
2316 /// <returns></returns> 2316 /// <returns></returns>
2317 public bool IncomingCreateObject(ISceneObject sog) 2317 public bool IncomingCreateObject(ISceneObject sog)
2318 { 2318 {
2319 //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2319 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2320 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
2321
2320 SceneObjectGroup newObject; 2322 SceneObjectGroup newObject;
2321 try 2323 try
2322 { 2324 {
@@ -3665,6 +3667,15 @@ namespace OpenSim.Region.Framework.Scenes
3665 return false; 3667 return false;
3666 } 3668 }
3667 3669
3670 int num = m_sceneGraph.GetNumberOfScenePresences();
3671
3672 if (num >= RegionInfo.RegionSettings.AgentLimit)
3673 {
3674 if (!Permissions.IsAdministrator(cAgentData.AgentID))
3675 return false;
3676 }
3677
3678
3668 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 3679 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
3669 3680
3670 if (childAgentUpdate != null) 3681 if (childAgentUpdate != null)
@@ -4966,6 +4977,17 @@ namespace OpenSim.Region.Framework.Scenes
4966 // child agent creation, thereby emulating the SL behavior. 4977 // child agent creation, thereby emulating the SL behavior.
4967 public bool QueryAccess(UUID agentID, Vector3 position, out string reason) 4978 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
4968 { 4979 {
4980 int num = m_sceneGraph.GetNumberOfScenePresences();
4981
4982 if (num >= RegionInfo.RegionSettings.AgentLimit)
4983 {
4984 if (!Permissions.IsAdministrator(agentID))
4985 {
4986 reason = "The region is full";
4987 return false;
4988 }
4989 }
4990
4969 reason = String.Empty; 4991 reason = String.Empty;
4970 return true; 4992 return true;
4971 } 4993 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 72f0402..fc31b65 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -800,6 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
800 return m_scenePresenceArray; 800 return m_scenePresenceArray;
801 } 801 }
802 802
803 public int GetNumberOfScenePresences()
804 {
805 return m_scenePresenceArray.Count;
806 }
807
803 /// <summary> 808 /// <summary>
804 /// Request a scene presence by UUID. Fast, indexed lookup. 809 /// Request a scene presence by UUID. Fast, indexed lookup.
805 /// </summary> 810 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3281eab..3b60f8c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -693,8 +693,9 @@ namespace OpenSim.Region.Framework.Scenes
693 { 693 {
694 TaskInventoryItem it = GetInventoryItem(item.ItemID); 694 TaskInventoryItem it = GetInventoryItem(item.ItemID);
695 if (it != null) 695 if (it != null)
696
697 { 696 {
697// m_log.DebugFormat("[PRIM INVENTORY]: Updating item {0} in {1}", item.Name, m_part.Name);
698
698 item.ParentID = m_part.UUID; 699 item.ParentID = m_part.UUID;
699 item.ParentPartID = m_part.UUID; 700 item.ParentPartID = m_part.UUID;
700 701
@@ -711,14 +712,16 @@ namespace OpenSim.Region.Framework.Scenes
711 m_items[item.ItemID] = item; 712 m_items[item.ItemID] = item;
712 m_inventorySerial++; 713 m_inventorySerial++;
713 } 714 }
714 715
715 if (fireScriptEvents) 716 if (fireScriptEvents)
716 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 717 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
718
717 if (considerChanged) 719 if (considerChanged)
718 { 720 {
719 HasInventoryChanged = true; 721 HasInventoryChanged = true;
720 m_part.ParentGroup.HasGroupChanged = true; 722 m_part.ParentGroup.HasGroupChanged = true;
721 } 723 }
724
722 return true; 725 return true;
723 } 726 }
724 else 727 else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 00a1487..fe4a7d1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2340,12 +2340,14 @@ namespace OpenSim.Region.Framework.Scenes
2340 2340
2341 #region Update Client(s) 2341 #region Update Client(s)
2342 2342
2343
2343 /// <summary> 2344 /// <summary>
2344 /// Sends a location update to the client connected to this scenePresence 2345 /// Sends a location update to the client connected to this scenePresence
2345 /// </summary> 2346 /// </summary>
2346 /// <param name="remoteClient"></param> 2347 /// <param name="remoteClient"></param>
2347 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2348 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2348 { 2349 {
2350
2349 // If the client is inactive, it's getting its updates from another 2351 // If the client is inactive, it's getting its updates from another
2350 // server. 2352 // server.
2351 if (remoteClient.IsActive) 2353 if (remoteClient.IsActive)
@@ -2358,8 +2360,8 @@ namespace OpenSim.Region.Framework.Scenes
2358 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2360 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2359 2361
2360 remoteClient.SendPrimUpdate( 2362 remoteClient.SendPrimUpdate(
2361 this, 2363 this,
2362 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity 2364 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
2363 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); 2365 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
2364 2366
2365 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2367 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
@@ -2367,16 +2369,31 @@ namespace OpenSim.Region.Framework.Scenes
2367 } 2369 }
2368 } 2370 }
2369 2371
2372
2373 // vars to support reduced update frequency when velocity is unchanged
2374 private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
2375 private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
2376
2370 /// <summary> 2377 /// <summary>
2371 /// Send a location/velocity/accelleration update to all agents in scene 2378 /// Send a location/velocity/accelleration update to all agents in scene
2372 /// </summary> 2379 /// </summary>
2373 public void SendTerseUpdateToAllClients() 2380 public void SendTerseUpdateToAllClients()
2374 { 2381 {
2375 m_perfMonMS = Util.EnvironmentTickCount(); 2382 int currentTick = Util.EnvironmentTickCount();
2376
2377 m_scene.ForEachClient(SendTerseUpdateToClient);
2378 2383
2379 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2384 // decrease update frequency when avatar is moving but velocity is not changing
2385 if (m_velocity.Length() < 0.01f
2386 || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f
2387 || currentTick - lastTerseUpdateToAllClientsTick > 1500)
2388 {
2389 m_perfMonMS = currentTick;
2390 lastVelocitySentToAllClients = m_velocity;
2391 lastTerseUpdateToAllClientsTick = currentTick;
2392
2393 m_scene.ForEachClient(SendTerseUpdateToClient);
2394
2395 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2396 }
2380 } 2397 }
2381 2398
2382 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2399 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -2632,18 +2649,17 @@ namespace OpenSim.Region.Framework.Scenes
2632 cadu.GroupAccess = 0; 2649 cadu.GroupAccess = 0;
2633 cadu.Position = AbsolutePosition; 2650 cadu.Position = AbsolutePosition;
2634 cadu.regionHandle = m_rootRegionHandle; 2651 cadu.regionHandle = m_rootRegionHandle;
2652
2653 // Throttles
2635 float multiplier = 1; 2654 float multiplier = 1;
2636 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 2655 int childRegions = m_knownChildRegions.Count;
2637 if (innacurateNeighbors != 0) 2656 if (childRegions != 0)
2638 { 2657 multiplier = 1f / childRegions;
2639 multiplier = 1f / (float)innacurateNeighbors; 2658
2640 } 2659 // Minimum throttle for a child region is 1/4 of the root region throttle
2641 if (multiplier <= 0f) 2660 if (multiplier <= 0.25f)
2642 {
2643 multiplier = 0.25f; 2661 multiplier = 0.25f;
2644 }
2645 2662
2646 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
2647 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); 2663 cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
2648 cadu.Velocity = Velocity; 2664 cadu.Velocity = Velocity;
2649 2665
@@ -3039,16 +3055,14 @@ namespace OpenSim.Region.Framework.Scenes
3039 3055
3040 // Throttles 3056 // Throttles
3041 float multiplier = 1; 3057 float multiplier = 1;
3042 int innacurateNeighbors = m_scene.GetInaccurateNeighborCount(); 3058 int childRegions = m_knownChildRegions.Count;
3043 if (innacurateNeighbors != 0) 3059 if (childRegions != 0)
3044 { 3060 multiplier = 1f / childRegions;
3045 multiplier = 1f / innacurateNeighbors; 3061
3046 } 3062 // Minimum throttle for a child region is 1/4 of the root region throttle
3047 if (multiplier <= 0f) 3063 if (multiplier <= 0.25f)
3048 {
3049 multiplier = 0.25f; 3064 multiplier = 0.25f;
3050 } 3065
3051 //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
3052 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); 3066 cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
3053 3067
3054 cAgent.HeadRotation = m_headrotation; 3068 cAgent.HeadRotation = m_headrotation;
@@ -3064,54 +3078,6 @@ namespace OpenSim.Region.Framework.Scenes
3064 3078
3065 cAgent.Appearance = new AvatarAppearance(m_appearance); 3079 cAgent.Appearance = new AvatarAppearance(m_appearance);
3066 3080
3067/*
3068 try
3069 {
3070 // We might not pass the Wearables in all cases...
3071 // They're only needed so that persistent changes to the appearance
3072 // are preserved in the new region where the user is moving to.
3073 // But in Hypergrid we might not let this happen.
3074 int i = 0;
3075 UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
3076 foreach (AvatarWearable aw in m_appearance.Wearables)
3077 {
3078 if (aw != null)
3079 {
3080 wears[i++] = aw.ItemID;
3081 wears[i++] = aw.AssetID;
3082 }
3083 else
3084 {
3085 wears[i++] = UUID.Zero;
3086 wears[i++] = UUID.Zero;
3087 }
3088 }
3089 cAgent.Wearables = wears;
3090
3091 cAgent.VisualParams = m_appearance.VisualParams;
3092
3093 if (m_appearance.Texture != null)
3094 cAgent.AgentTextures = m_appearance.Texture.GetBytes();
3095 }
3096 catch (Exception e)
3097 {
3098 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
3099 }
3100
3101 //Attachments
3102 List<int> attPoints = m_appearance.GetAttachedPoints();
3103 if (attPoints != null)
3104 {
3105 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3106 int i = 0;
3107 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3108 foreach (int point in attPoints)
3109 {
3110 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3111 }
3112 cAgent.Attachments = attachs;
3113 }
3114*/
3115 lock (scriptedcontrols) 3081 lock (scriptedcontrols)
3116 { 3082 {
3117 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 3083 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3131,9 +3097,24 @@ namespace OpenSim.Region.Framework.Scenes
3131 } 3097 }
3132 catch { } 3098 catch { }
3133 3099
3134 // cAgent.GroupID = ?? 3100 // Attachment objects
3135 // Groups??? 3101 if (m_attachments != null && m_attachments.Count > 0)
3136 3102 {
3103 cAgent.AttachmentObjects = new List<ISceneObject>();
3104 cAgent.AttachmentObjectStates = new List<string>();
3105 IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3106 foreach (SceneObjectGroup sog in m_attachments)
3107 {
3108 // We need to make a copy and pass that copy
3109 // because of transfers withn the same sim
3110 ISceneObject clone = sog.CloneForNewScene();
3111 // Attachment module assumes that GroupPosition holds the offsets...!
3112 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3113 ((SceneObjectGroup)clone).RootPart.IsAttachment = false;
3114 cAgent.AttachmentObjects.Add(clone);
3115 cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
3116 }
3117 }
3137 } 3118 }
3138 3119
3139 public void CopyFrom(AgentData cAgent) 3120 public void CopyFrom(AgentData cAgent)
@@ -3174,50 +3155,6 @@ namespace OpenSim.Region.Framework.Scenes
3174 AddToPhysicalScene(isFlying); 3155 AddToPhysicalScene(isFlying);
3175 } 3156 }
3176 3157
3177/*
3178 uint i = 0;
3179 try
3180 {
3181 if (cAgent.Wearables == null)
3182 cAgent.Wearables = new UUID[0];
3183 AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
3184 for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
3185 {
3186 UUID itemId = cAgent.Wearables[n];
3187 UUID assetId = cAgent.Wearables[n + 1];
3188 wears[i++] = new AvatarWearable(itemId, assetId);
3189 }
3190 // m_appearance.Wearables = wears;
3191 Primitive.TextureEntry textures = null;
3192 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3193 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3194
3195 byte[] visuals = null;
3196
3197 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3198 visuals = (byte[])cAgent.VisualParams.Clone();
3199
3200 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3201 }
3202 catch (Exception e)
3203 {
3204 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
3205 }
3206
3207 // Attachments
3208 try
3209 {
3210 if (cAgent.Attachments != null)
3211 {
3212 m_appearance.ClearAttachments();
3213 foreach (AvatarAttachment att in cAgent.Attachments)
3214 {
3215 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3216 }
3217 }
3218 }
3219 catch { }
3220*/
3221 try 3158 try
3222 { 3159 {
3223 lock (scriptedcontrols) 3160 lock (scriptedcontrols)
@@ -3247,8 +3184,18 @@ namespace OpenSim.Region.Framework.Scenes
3247 } 3184 }
3248 catch { } 3185 catch { }
3249 3186
3250 //cAgent.GroupID = ?? 3187 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3251 //Groups??? 3188 {
3189 m_attachments = new List<SceneObjectGroup>();
3190 int i = 0;
3191 foreach (ISceneObject so in cAgent.AttachmentObjects)
3192 {
3193 ((SceneObjectGroup)so).LocalId = 0;
3194 ((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
3195 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3196 m_scene.IncomingCreateObject(so);
3197 }
3198 }
3252 } 3199 }
3253 3200
3254 public bool CopyAgent(out IAgentData agent) 3201 public bool CopyAgent(out IAgentData agent)
@@ -3271,10 +3218,7 @@ namespace OpenSim.Region.Framework.Scenes
3271 3218
3272 m_updateflag = true; 3219 m_updateflag = true;
3273 3220
3274 // The magic constant 0.95f seems to make walking feel less jerky, 3221 Velocity = force;
3275 // probably because it hackishly accounts for the overall latency of
3276 // these Velocity updates -- Diva
3277 Velocity = force * .95F;
3278 3222
3279 m_forceToApply = null; 3223 m_forceToApply = null;
3280 } 3224 }
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index 6a24cc1..db17d8f 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -82,6 +82,14 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
82 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
83 83
84 scene.AddCommand( 84 scene.AddCommand(
85 this, "show pqueues",
86 "show pqueues [full]",
87 "Show priority queue data for each client",
88 "Without the 'full' option, only root agents are shown."
89 + " With the 'full' option child agents are also shown.",
90 ShowPQueuesReport);
91
92 scene.AddCommand(
85 this, "show queues", 93 this, "show queues",
86 "show queues [full]", 94 "show queues [full]",
87 "Show queue data for each client", 95 "Show queue data for each client",
@@ -119,6 +127,11 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
119// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); 127// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
120 } 128 }
121 129
130 protected void ShowPQueuesReport(string module, string[] cmd)
131 {
132 MainConsole.Instance.Output(GetPQueuesReport(cmd));
133 }
134
122 protected void ShowQueuesReport(string module, string[] cmd) 135 protected void ShowQueuesReport(string module, string[] cmd)
123 { 136 {
124 MainConsole.Instance.Output(GetQueuesReport(cmd)); 137 MainConsole.Instance.Output(GetQueuesReport(cmd));
@@ -155,6 +168,80 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
155 ""); 168 "");
156 } 169 }
157 170
171
172 /// <summary>
173 /// Generate UDP Queue data report for each client
174 /// </summary>
175 /// <param name="showParams"></param>
176 /// <returns></returns>
177 protected string GetPQueuesReport(string[] showParams)
178 {
179 bool showChildren = false;
180 string pname = "";
181
182 if (showParams.Length > 2 && showParams[2] == "full")
183 showChildren = true;
184 else if (showParams.Length > 3)
185 pname = showParams[2] + " " + showParams[3];
186
187 StringBuilder report = new StringBuilder();
188
189 int columnPadding = 2;
190 int maxNameLength = 18;
191 int maxRegionNameLength = 14;
192 int maxTypeLength = 4;
193 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
194
195 report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
196 report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
197 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
198
199 report.AppendFormat(
200 "{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7} {10,7} {11,7}\n",
201 "Pri 0",
202 "Pri 1",
203 "Pri 2",
204 "Pri 3",
205 "Pri 4",
206 "Pri 5",
207 "Pri 6",
208 "Pri 7",
209 "Pri 8",
210 "Pri 9",
211 "Pri 10",
212 "Pri 11");
213
214 lock (m_scenes)
215 {
216 foreach (Scene scene in m_scenes.Values)
217 {
218 scene.ForEachClient(
219 delegate(IClientAPI client)
220 {
221 if (client is LLClientView)
222 {
223 bool isChild = scene.PresenceChildStatus(client.AgentId);
224 if (isChild && !showChildren)
225 return;
226
227 string name = client.Name;
228 if (pname != "" && name != pname)
229 return;
230
231 string regionName = scene.RegionInfo.RegionName;
232
233 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
234 report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
235 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
236 report.AppendLine(((LLClientView)client).EntityUpdateQueue.ToString());
237 }
238 });
239 }
240 }
241
242 return report.ToString();
243 }
244
158 /// <summary> 245 /// <summary>
159 /// Generate UDP Queue data report for each client 246 /// Generate UDP Queue data report for each client
160 /// </summary> 247 /// </summary>
@@ -163,10 +250,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
163 protected string GetQueuesReport(string[] showParams) 250 protected string GetQueuesReport(string[] showParams)
164 { 251 {
165 bool showChildren = false; 252 bool showChildren = false;
253 string pname = "";
166 254
167 if (showParams.Length > 2 && showParams[2] == "full") 255 if (showParams.Length > 2 && showParams[2] == "full")
168 showChildren = true; 256 showChildren = true;
169 257 else if (showParams.Length > 3)
258 pname = showParams[2] + " " + showParams[3];
259
170 StringBuilder report = new StringBuilder(); 260 StringBuilder report = new StringBuilder();
171 261
172 int columnPadding = 2; 262 int columnPadding = 2;
@@ -224,6 +314,9 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
224 return; 314 return;
225 315
226 string name = client.Name; 316 string name = client.Name;
317 if (pname != "" && name != pname)
318 return;
319
227 string regionName = scene.RegionInfo.RegionName; 320 string regionName = scene.RegionInfo.RegionName;
228 321
229 report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); 322 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
@@ -249,10 +342,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
249 protected string GetThrottlesReport(string[] showParams) 342 protected string GetThrottlesReport(string[] showParams)
250 { 343 {
251 bool showChildren = false; 344 bool showChildren = false;
345 string pname = "";
252 346
253 if (showParams.Length > 2 && showParams[2] == "full") 347 if (showParams.Length > 2 && showParams[2] == "full")
254 showChildren = true; 348 showChildren = true;
255 349 else if (showParams.Length > 3)
350 pname = showParams[2] + " " + showParams[3];
351
256 StringBuilder report = new StringBuilder(); 352 StringBuilder report = new StringBuilder();
257 353
258 int columnPadding = 2; 354 int columnPadding = 2;
@@ -302,7 +398,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
302 if (client is LLClientView) 398 if (client is LLClientView)
303 { 399 {
304 LLClientView llClient = client as LLClientView; 400 LLClientView llClient = client as LLClientView;
305 401
306 if (firstClient) 402 if (firstClient)
307 { 403 {
308 report.AppendLine(GetServerThrottlesReport(llClient.UDPServer)); 404 report.AppendLine(GetServerThrottlesReport(llClient.UDPServer));
@@ -314,6 +410,9 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
314 return; 410 return;
315 411
316 string name = client.Name; 412 string name = client.Name;
413 if (pname != "" && name != pname)
414 return;
415
317 string regionName = scene.RegionInfo.RegionName; 416 string regionName = scene.RegionInfo.RegionName;
318 417
319 LLUDPClient llUdpClient = llClient.UDPClient; 418 LLUDPClient llUdpClient = llClient.UDPClient;
@@ -352,7 +451,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
352 int maxRegionNameLength = 14; 451 int maxRegionNameLength = 14;
353 int maxTypeLength = 4; 452 int maxTypeLength = 4;
354 453
355 string name = "SERVER AGENT LIMITS"; 454 string name = "SERVER AGENT RATES";
356 455
357 report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); 456 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
358 report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding)); 457 report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding));
@@ -362,13 +461,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
362 report.AppendFormat( 461 report.AppendFormat(
363 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", 462 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
364 (throttleRates.Total * 8) / 1000, 463 (throttleRates.Total * 8) / 1000,
365 (throttleRates.ResendLimit * 8) / 1000, 464 (throttleRates.Resend * 8) / 1000,
366 (throttleRates.LandLimit * 8) / 1000, 465 (throttleRates.Land * 8) / 1000,
367 (throttleRates.WindLimit * 8) / 1000, 466 (throttleRates.Wind * 8) / 1000,
368 (throttleRates.CloudLimit * 8) / 1000, 467 (throttleRates.Cloud * 8) / 1000,
369 (throttleRates.TaskLimit * 8) / 1000, 468 (throttleRates.Task * 8) / 1000,
370 (throttleRates.TextureLimit * 8) / 1000, 469 (throttleRates.Texture * 8) / 1000,
371 (throttleRates.AssetLimit * 8) / 1000); 470 (throttleRates.Asset * 8) / 1000);
372 471
373 return report.ToString(); 472 return report.ToString();
374 } 473 }
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 372a59c..8b6fb4f 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Server.Handlers.Simulation
50 public class AgentHandler 50 public class AgentHandler
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
53 private ISimulationService m_SimulationService; 54 private ISimulationService m_SimulationService;
54 55
55 protected bool m_Proxy = false; 56 protected bool m_Proxy = false;
@@ -275,7 +276,7 @@ namespace OpenSim.Server.Handlers.Simulation
275 AgentData agent = new AgentData(); 276 AgentData agent = new AgentData();
276 try 277 try
277 { 278 {
278 agent.Unpack(args); 279 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
279 } 280 }
280 catch (Exception ex) 281 catch (Exception ex)
281 { 282 {
@@ -295,7 +296,7 @@ namespace OpenSim.Server.Handlers.Simulation
295 AgentPosition agent = new AgentPosition(); 296 AgentPosition agent = new AgentPosition();
296 try 297 try
297 { 298 {
298 agent.Unpack(args); 299 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
299 } 300 }
300 catch (Exception ex) 301 catch (Exception ex)
301 { 302 {
@@ -342,7 +343,8 @@ namespace OpenSim.Server.Handlers.Simulation
342 destination.RegionID = regionID; 343 destination.RegionID = regionID;
343 344
344 string reason; 345 string reason;
345 bool result = m_SimulationService.QueryAccess(destination, id, position, out reason); 346 string version;
347 bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason);
346 348
347 responsedata["int_response_code"] = HttpStatusCode.OK; 349 responsedata["int_response_code"] = HttpStatusCode.OK;
348 350
@@ -350,6 +352,7 @@ namespace OpenSim.Server.Handlers.Simulation
350 352
351 resp["success"] = OSD.FromBoolean(result); 353 resp["success"] = OSD.FromBoolean(result);
352 resp["reason"] = OSD.FromString(reason); 354 resp["reason"] = OSD.FromString(reason);
355 resp["version"] = OSD.FromString(version);
353 356
354 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); 357 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
355 } 358 }
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index cd9f2bf..a662abb 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -158,7 +158,10 @@ namespace OpenSim.Services.Connectors
158 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) 158 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
159 { 159 {
160 InventoryCollection inventory = new InventoryCollection(); 160 InventoryCollection inventory = new InventoryCollection();
161 161 inventory.Folders = new List<InventoryFolderBase>();
162 inventory.Items = new List<InventoryItemBase>();
163 inventory.UserID = principalID;
164
162 try 165 try
163 { 166 {
164 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT", 167 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
@@ -172,11 +175,6 @@ namespace OpenSim.Services.Connectors
172 if (ret.Count == 0) 175 if (ret.Count == 0)
173 return null; 176 return null;
174 177
175
176 inventory.Folders = new List<InventoryFolderBase>();
177 inventory.Items = new List<InventoryItemBase>();
178 inventory.UserID = principalID;
179
180 Dictionary<string,object> folders = 178 Dictionary<string,object> folders =
181 (Dictionary<string,object>)ret["FOLDERS"]; 179 (Dictionary<string,object>)ret["FOLDERS"];
182 Dictionary<string,object> items = 180 Dictionary<string,object> items =
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 93b3ae6..7545db8 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -241,7 +241,7 @@ namespace OpenSim.Services.Connectors.Simulation
241 if (args != null) 241 if (args != null)
242 { 242 {
243 agent = new CompleteAgentData(); 243 agent = new CompleteAgentData();
244 agent.Unpack(args); 244 agent.Unpack(args, null);
245 return true; 245 return true;
246 } 246 }
247 } 247 }
@@ -256,9 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
256 256
257 /// <summary> 257 /// <summary>
258 /// </summary> 258 /// </summary>
259 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 259 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
260 { 260 {
261 reason = "Failed to contact destination"; 261 reason = "Failed to contact destination";
262 version = "Unknown";
262 263
263 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); 264 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
264 265
@@ -274,23 +275,27 @@ namespace OpenSim.Services.Connectors.Simulation
274 try 275 try
275 { 276 {
276 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); 277 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000);
278 OSDMap data = (OSDMap)result["_Result"];
279
277 bool success = result["success"].AsBoolean(); 280 bool success = result["success"].AsBoolean();
278 reason = result["reason"].AsString(); 281 reason = data["reason"].AsString();
282 if (data["version"] != null && data["version"].AsString() != string.Empty)
283 version = data["version"].AsString();
279 284
280 //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success); 285 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString());
281 286
282 if (!success) 287 if (!success)
283 { 288 {
284 if (result.ContainsKey("Message")) 289 if (data.ContainsKey("Message"))
285 { 290 {
286 string message = result["Message"].AsString(); 291 string message = data["Message"].AsString();
287 if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region 292 if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
288 { 293 {
289 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); 294 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
290 return true; 295 return true;
291 } 296 }
292 297
293 reason = result["Message"]; 298 reason = data["Message"];
294 } 299 }
295 else 300 else
296 { 301 {
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index b66bfed..9385b8d 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Text.RegularExpressions;
32 33
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
@@ -57,6 +58,9 @@ namespace OpenSim.Services.HypergridService
57 private static IUserAgentService m_UserAgentService; 58 private static IUserAgentService m_UserAgentService;
58 private static ISimulationService m_SimulationService; 59 private static ISimulationService m_SimulationService;
59 60
61 protected string m_AllowedClients = string.Empty;
62 protected string m_DeniedClients = string.Empty;
63
60 private static UUID m_ScopeID; 64 private static UUID m_ScopeID;
61 private static bool m_AllowTeleportsToAnyRegion; 65 private static bool m_AllowTeleportsToAnyRegion;
62 private static string m_ExternalName; 66 private static string m_ExternalName;
@@ -104,6 +108,9 @@ namespace OpenSim.Services.HypergridService
104 else if (simulationService != string.Empty) 108 else if (simulationService != string.Empty)
105 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); 109 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
106 110
111 m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty);
112 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty);
113
107 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 114 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
108 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 115 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
109 116
@@ -181,8 +188,36 @@ namespace OpenSim.Services.HypergridService
181 string authURL = string.Empty; 188 string authURL = string.Empty;
182 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 189 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
183 authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 190 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
184 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", 191 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}",
185 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); 192 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName,
193 aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0);
194
195 //
196 // Check client
197 //
198 if (m_AllowedClients != string.Empty)
199 {
200 Regex arx = new Regex(m_AllowedClients);
201 Match am = arx.Match(aCircuit.Viewer);
202
203 if (!am.Success)
204 {
205 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is not allowed", aCircuit.Viewer);
206 return false;
207 }
208 }
209
210 if (m_DeniedClients != string.Empty)
211 {
212 Regex drx = new Regex(m_DeniedClients);
213 Match dm = drx.Match(aCircuit.Viewer);
214
215 if (dm.Success)
216 {
217 m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: client {0} is denied", aCircuit.Viewer);
218 return false;
219 }
220 }
186 221
187 // 222 //
188 // Authenticate the user 223 // Authenticate the user
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 55c9cc5..5f9ce6d 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces
67 67
68 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 68 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
69 69
70 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason); 70 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason);
71 71
72 /// <summary> 72 /// <summary>
73 /// Message from receiving region to departing region, telling it got contacted by the client. 73 /// Message from receiving region to departing region, telling it got contacted by the client.
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index e602412..0af35c8 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -244,7 +244,7 @@ namespace OpenSim.Services.InventoryService
244 // connector. So we disregard the principal and look 244 // connector. So we disregard the principal and look
245 // by ID. 245 // by ID.
246 // 246 //
247 m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString()); 247 //m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString());
248 InventoryCollection inventory = new InventoryCollection(); 248 InventoryCollection inventory = new InventoryCollection();
249 inventory.UserID = principalID; 249 inventory.UserID = principalID;
250 inventory.Folders = new List<InventoryFolderBase>(); 250 inventory.Folders = new List<InventoryFolderBase>();
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index d364aa4..9bcc3dd 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -77,7 +77,11 @@ namespace OpenSim.Services.LLLoginService
77 protected string m_MapTileURL; 77 protected string m_MapTileURL;
78 protected string m_SearchURL; 78 protected string m_SearchURL;
79 79
80 protected string m_AllowedClients;
81 protected string m_DeniedClients;
82
80 IConfig m_LoginServerConfig; 83 IConfig m_LoginServerConfig;
84 IConfig m_ClientsConfig;
81 85
82 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) 86 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
83 { 87 {
@@ -105,7 +109,10 @@ namespace OpenSim.Services.LLLoginService
105 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 109 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
106 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); 110 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
107 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); 111 m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
108 112
113 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
114 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);
115
109 // These are required; the others aren't 116 // These are required; the others aren't
110 if (accountService == string.Empty || authService == string.Empty) 117 if (accountService == string.Empty || authService == string.Empty)
111 throw new Exception("LoginService is missing service specifications"); 118 throw new Exception("LoginService is missing service specifications");
@@ -215,11 +222,38 @@ namespace OpenSim.Services.LLLoginService
215 bool success = false; 222 bool success = false;
216 UUID session = UUID.Random(); 223 UUID session = UUID.Random();
217 224
218 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} from {2} with user agent {3} starting in {4}", 225 m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}",
219 firstName, lastName, clientIP.Address.ToString(), clientVersion, startLocation); 226 firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0);
220 try 227 try
221 { 228 {
222 // 229 //
230 // Check client
231 //
232 if (m_AllowedClients != string.Empty)
233 {
234 Regex arx = new Regex(m_AllowedClients);
235 Match am = arx.Match(clientVersion);
236
237 if (!am.Success)
238 {
239 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is not allowed", clientVersion);
240 return LLFailedLoginResponse.LoginBlockedProblem;
241 }
242 }
243
244 if (m_DeniedClients != string.Empty)
245 {
246 Regex drx = new Regex(m_DeniedClients);
247 Match dm = drx.Match(clientVersion);
248
249 if (dm.Success)
250 {
251 m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is denied", clientVersion);
252 return LLFailedLoginResponse.LoginBlockedProblem;
253 }
254 }
255
256 //
223 // Get the account and check that it exists 257 // Get the account and check that it exists
224 // 258 //
225 UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); 259 UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName);