aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs122
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs30
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs50
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs33
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs15
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs204
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs264
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs74
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs272
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs17
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs271
16 files changed, 134 insertions, 1241 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 4e6d196..1236e83 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Scenes.Serialization; 45using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
47using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
48using OpenSim.Framework.Client;
49using OpenSim.Services.Interfaces; 48using OpenSim.Services.Interfaces;
50 49
51using Caps = OpenSim.Framework.Capabilities.Caps; 50using Caps = OpenSim.Framework.Capabilities.Caps;
@@ -360,8 +359,8 @@ namespace OpenSim.Region.ClientStack.Linden
360 public string SeedCapRequest(string request, string path, string param, 359 public string SeedCapRequest(string request, string path, string param,
361 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 360 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
362 { 361 {
363// m_log.DebugFormat( 362 m_log.DebugFormat(
364// "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); 363 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
365 364
366 if (!m_HostCapsObj.WaitForActivation()) 365 if (!m_HostCapsObj.WaitForActivation())
367 return string.Empty; 366 return string.Empty;
@@ -789,99 +788,10 @@ namespace OpenSim.Region.ClientStack.Linden
789 } 788 }
790 else if (inventoryType == "object") 789 else if (inventoryType == "object")
791 { 790 {
792<<<<<<< HEAD
793 inType = (sbyte)InventoryType.Object;
794 assType = (sbyte)AssetType.Object;
795
796 List<Vector3> positions = new List<Vector3>();
797 List<Quaternion> rotations = new List<Quaternion>();
798 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
799 OSDArray instance_list = (OSDArray)request["instance_list"];
800 OSDArray mesh_list = (OSDArray)request["mesh_list"];
801 OSDArray texture_list = (OSDArray)request["texture_list"];
802 SceneObjectGroup grp = null;
803
804 InventoryFolderBase textureUploadFolder = null;
805
806 List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>();
807 List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>();
808 IClientInventory clientInv = null;
809
810 if (texture_list.Count > 0)
811 {
812 ScenePresence avatar = null;
813 m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
814
815 if (avatar != null)
816 {
817 IClientCore core = (IClientCore)avatar.ControllingClient;
818
819 if (core.TryGet<IClientInventory>(out clientInv))
820 {
821 var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture);
822 textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1);
823 if (m_Scene.InventoryService.AddFolder(textureUploadFolder))
824 {
825 foldersToUpdate.Add(textureUploadFolder);
826
827 m_log.DebugFormat(
828 "[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}",
829 textureUploadFolder.Name, textureUploadFolder.ID, assetName);
830 }
831 else
832 {
833 textureUploadFolder = null;
834 }
835 }
836 }
837 }
838
839 List<UUID> textures = new List<UUID>();
840 for (int i = 0; i < texture_list.Count; i++)
841 {
842 AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, "");
843 textureAsset.Data = texture_list[i].AsBinary();
844 m_assetService.Store(textureAsset);
845 textures.Add(textureAsset.FullID);
846
847 if (textureUploadFolder != null)
848 {
849 InventoryItemBase textureItem = new InventoryItemBase();
850 textureItem.Owner = m_HostCapsObj.AgentID;
851 textureItem.CreatorId = m_HostCapsObj.AgentID.ToString();
852 textureItem.CreatorData = String.Empty;
853 textureItem.ID = UUID.Random();
854 textureItem.AssetID = textureAsset.FullID;
855 textureItem.Description = assetDescription;
856 textureItem.Name = assetName + " - Texture " + (i + 1).ToString();
857 textureItem.AssetType = (int)AssetType.Texture;
858 textureItem.InvType = (int)InventoryType.Texture;
859 textureItem.Folder = textureUploadFolder.ID;
860 textureItem.CurrentPermissions
861 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
862 textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
863 textureItem.EveryOnePermissions = 0;
864 textureItem.NextPermissions = (uint)PermissionMask.All;
865 textureItem.CreationDate = Util.UnixTimeSinceEpoch();
866 m_Scene.InventoryService.AddItem(textureItem);
867 itemsToUpdate.Add(textureItem);
868
869 m_log.DebugFormat(
870 "[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}",
871 textureItem.Name, textureItem.ID, assetName);
872 }
873 }
874
875 if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0))
876 {
877 clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray());
878 }
879=======
880 if (assetType == "mesh") // this code for now is for mesh models uploads only 791 if (assetType == "mesh") // this code for now is for mesh models uploads only
881 { 792 {
882 inType = (sbyte)InventoryType.Object; 793 inType = (sbyte)InventoryType.Object;
883 assType = (sbyte)AssetType.Object; 794 assType = (sbyte)AssetType.Object;
884>>>>>>> avn/ubitvar
885 795
886 List<Vector3> positions = new List<Vector3>(); 796 List<Vector3> positions = new List<Vector3>();
887 List<Quaternion> rotations = new List<Quaternion>(); 797 List<Quaternion> rotations = new List<Quaternion>();
@@ -1467,24 +1377,17 @@ namespace OpenSim.Region.ClientStack.Linden
1467 { 1377 {
1468 string message; 1378 string message;
1469 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message); 1379 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message);
1470 if (client != null) 1380 if (copyItem != null && client != null)
1471 { 1381 {
1472 if (copyItem != null) 1382 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
1473 { 1383 client.SendBulkUpdateInventory(copyItem);
1474 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
1475 client.SendBulkUpdateInventory(copyItem);
1476 }
1477 else
1478 {
1479 client.SendAgentAlertMessage(message, false);
1480 }
1481 } 1384 }
1482 } 1385 }
1483 else 1386 else
1484 { 1387 {
1485 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); 1388 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
1486 if (client != null) 1389 if (client != null)
1487 client.SendAgentAlertMessage("Failed to retrieve item", false); 1390 client.SendAlertMessage("Failed to retrieve item");
1488 } 1391 }
1489 } 1392 }
1490 catch (Exception e) 1393 catch (Exception e)
@@ -1656,14 +1559,13 @@ namespace OpenSim.Region.ClientStack.Linden
1656 string param, IOSHttpRequest httpRequest, 1559 string param, IOSHttpRequest httpRequest,
1657 IOSHttpResponse httpResponse) 1560 IOSHttpResponse httpResponse)
1658 { 1561 {
1659 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); 1562// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1660 OSDMap accessPrefs = (OSDMap)req["access_prefs"];
1661 string desiredMaturity = accessPrefs["max"];
1662
1663 OSDMap resp = new OSDMap(); 1563 OSDMap resp = new OSDMap();
1664 OSDMap respAccessPrefs = new OSDMap(); 1564
1665 respAccessPrefs["max"] = desiredMaturity; // echoing the maturity back means success 1565 OSDMap accessPrefs = new OSDMap();
1666 resp["access_prefs"] = respAccessPrefs; 1566 accessPrefs["max"] = "A";
1567
1568 resp["access_prefs"] = accessPrefs;
1667 1569
1668 string response = OSDParser.SerializeLLSDXmlString(resp); 1570 string response = OSDParser.SerializeLLSDXmlString(resp);
1669 return response; 1571 return response;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
index c241075..b735dfa 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
@@ -40,8 +40,8 @@ using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using Caps = OpenSim.Framework.Capabilities.Caps; 41using Caps = OpenSim.Framework.Capabilities.Caps;
42 42
43[assembly: Addin("LindenCaps", OpenSim.VersionInfo.VersionNumber)] 43[assembly: Addin("LindenCaps", "0.1")]
44[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] 44[assembly: AddinDependency("OpenSim", "0.5")]
45namespace OpenSim.Region.ClientStack.Linden 45namespace OpenSim.Region.ClientStack.Linden
46{ 46{
47 47
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 5fb028c..5d50eba 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -177,7 +177,6 @@ namespace OpenSim.Region.ClientStack.Linden
177 } 177 }
178 178
179 /// <summary> 179 /// <summary>
180<<<<<<< HEAD
181 /// Always returns a valid queue 180 /// Always returns a valid queue
182 /// </summary> 181 /// </summary>
183 /// <param name="agentId"></param> 182 /// <param name="agentId"></param>
@@ -201,8 +200,7 @@ namespace OpenSim.Region.ClientStack.Linden
201 } 200 }
202 201
203 /// <summary> 202 /// <summary>
204======= 203
205>>>>>>> avn/ubitvar
206 /// May return a null queue 204 /// May return a null queue
207 /// </summary> 205 /// </summary>
208 /// <param name="agentId"></param> 206 /// <param name="agentId"></param>
@@ -290,17 +288,11 @@ namespace OpenSim.Region.ClientStack.Linden
290 public void OnRegisterCaps(UUID agentID, Caps caps) 288 public void OnRegisterCaps(UUID agentID, Caps caps)
291 { 289 {
292 // Register an event queue for the client 290 // Register an event queue for the client
293<<<<<<< HEAD
294 291
295 if (DebugLevel > 0) 292 if (DebugLevel > 0)
296 m_log.DebugFormat( 293 m_log.DebugFormat(
297 "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", 294 "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
298 agentID, caps, m_scene.RegionInfo.RegionName); 295 agentID, caps, m_scene.RegionInfo.RegionName);
299=======
300 m_log.DebugFormat(
301 "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
302 agentID, caps, m_scene.RegionInfo.RegionName);
303>>>>>>> avn/ubitvar
304 296
305 UUID eventQueueGetUUID; 297 UUID eventQueueGetUUID;
306 Queue<OSD> queue; 298 Queue<OSD> queue;
@@ -519,14 +511,9 @@ namespace OpenSim.Region.ClientStack.Linden
519 511
520 public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) 512 public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
521 { 513 {
522<<<<<<< HEAD
523 if (DebugLevel > 0) 514 if (DebugLevel > 0)
524 m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}", 515 m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}",
525 LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY); 516 LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY);
526=======
527 m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>",
528 LogHeader, handle, avatarID, regionSizeX, regionSizeY);
529>>>>>>> avn/ubitvar
530 517
531 OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); 518 OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
532 Enqueue(item, avatarID); 519 Enqueue(item, avatarID);
@@ -535,15 +522,10 @@ namespace OpenSim.Region.ClientStack.Linden
535 public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath, 522 public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
536 ulong regionHandle, int regionSizeX, int regionSizeY) 523 ulong regionHandle, int regionSizeX, int regionSizeY)
537 { 524 {
538<<<<<<< HEAD
539 if (DebugLevel > 0) 525 if (DebugLevel > 0)
540 m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}", 526 m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}",
541 LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY); 527 LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY);
542 528
543=======
544 m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>",
545 LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
546>>>>>>> avn/ubitvar
547 OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY); 529 OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
548 Enqueue(item, avatarID); 530 Enqueue(item, avatarID);
549 } 531 }
@@ -553,14 +535,9 @@ namespace OpenSim.Region.ClientStack.Linden
553 uint locationID, uint flags, string capsURL, 535 uint locationID, uint flags, string capsURL,
554 UUID avatarID, int regionSizeX, int regionSizeY) 536 UUID avatarID, int regionSizeX, int regionSizeY)
555 { 537 {
556<<<<<<< HEAD
557 if (DebugLevel > 0) 538 if (DebugLevel > 0)
558 m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}", 539 m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}",
559 LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY); 540 LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY);
560=======
561 m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>",
562 LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
563>>>>>>> avn/ubitvar
564 541
565 OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, 542 OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
566 locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY); 543 locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
@@ -571,14 +548,9 @@ namespace OpenSim.Region.ClientStack.Linden
571 IPEndPoint newRegionExternalEndPoint, 548 IPEndPoint newRegionExternalEndPoint,
572 string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) 549 string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
573 { 550 {
574<<<<<<< HEAD
575 if (DebugLevel > 0) 551 if (DebugLevel > 0)
576 m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", 552 m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
577 LogHeader, handle, avatarID, regionSizeX, regionSizeY); 553 LogHeader, handle, avatarID, regionSizeX, regionSizeY);
578=======
579 m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
580 LogHeader, handle, avatarID, regionSizeX, regionSizeY);
581>>>>>>> avn/ubitvar
582 554
583 OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, 555 OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
584 capsURL, avatarID, sessionID, regionSizeX, regionSizeY); 556 capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index 8b7e4c1..50e22f5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -77,13 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden
77 llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); 77 llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
78 llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); 78 llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
79 llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); 79 llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));
80<<<<<<< HEAD
81 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint) regionSizeX));
82 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint) regionSizeY));
83=======
84 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); 80 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
85 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); 81 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
86>>>>>>> avn/ubitvar
87 82
88 OSDArray arr = new OSDArray(1); 83 OSDArray arr = new OSDArray(1);
89 arr.Add(llsdSimInfo); 84 arr.Add(llsdSimInfo);
@@ -176,12 +171,8 @@ namespace OpenSim.Region.ClientStack.Linden
176 info.Add("SimAccess", OSD.FromInteger(simAccess)); 171 info.Add("SimAccess", OSD.FromInteger(simAccess));
177 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); 172 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
178 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); 173 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
179<<<<<<< HEAD
180 info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
181=======
182// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation 174// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
183 info.Add("TeleportFlags", OSD.FromUInteger(flags)); 175 info.Add("TeleportFlags", OSD.FromUInteger(flags));
184>>>>>>> avn/ubitvar
185 info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); 176 info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
186 info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); 177 info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
187 178
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index 91efe8a..b5a70040 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -60,11 +60,10 @@ namespace OpenSim.Region.ClientStack.Linden
60 private IAssetService m_AssetService; 60 private IAssetService m_AssetService;
61 private bool m_Enabled = true; 61 private bool m_Enabled = true;
62 private string m_URL; 62 private string m_URL;
63<<<<<<< HEAD 63
64 private string m_URL2; 64 private string m_URL2;
65 private string m_RedirectURL = null; 65 private string m_RedirectURL = null;
66 private string m_RedirectURL2 = null; 66 private string m_RedirectURL2 = null;
67=======
68 67
69 struct aPollRequest 68 struct aPollRequest
70 { 69 {
@@ -94,7 +93,7 @@ namespace OpenSim.Region.ClientStack.Linden
94 new OpenMetaverse.BlockingQueue<aPollRequest>(); 93 new OpenMetaverse.BlockingQueue<aPollRequest>();
95 94
96 private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>(); 95 private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>();
97>>>>>>> avn/ubitvar 96
98 97
99 #region Region Module interfaceBase Members 98 #region Region Module interfaceBase Members
100 99
@@ -129,12 +128,9 @@ namespace OpenSim.Region.ClientStack.Linden
129 if (m_URL2 != string.Empty) 128 if (m_URL2 != string.Empty)
130 { 129 {
131 m_Enabled = true; 130 m_Enabled = true;
132<<<<<<< HEAD 131
133 m_RedirectURL2 = config.GetString("GetMesh2RedirectURL"); 132 m_RedirectURL2 = config.GetString("GetMesh2RedirectURL");
134 } 133 }
135=======
136
137>>>>>>> avn/ubitvar
138 } 134 }
139 135
140 public void AddRegion(Scene pScene) 136 public void AddRegion(Scene pScene)
@@ -177,7 +173,7 @@ namespace OpenSim.Region.ClientStack.Linden
177 173
178 for (uint i = 0; i < 2; i++) 174 for (uint i = 0; i < 2; i++)
179 { 175 {
180 m_workerThreads[i] = Watchdog.StartThread(DoMeshRequests, 176 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
181 String.Format("MeshWorkerThread{0}", i), 177 String.Format("MeshWorkerThread{0}", i),
182 ThreadPriority.Normal, 178 ThreadPriority.Normal,
183 false, 179 false,
@@ -336,21 +332,6 @@ namespace OpenSim.Region.ClientStack.Linden
336 332
337 public void RegisterCaps(UUID agentID, Caps caps) 333 public void RegisterCaps(UUID agentID, Caps caps)
338 { 334 {
339<<<<<<< HEAD
340 UUID capID = UUID.Random();
341 bool getMeshRegistered = false;
342
343 if (m_URL == string.Empty)
344 {
345
346 }
347 else if (m_URL == "localhost")
348 {
349 getMeshRegistered = true;
350 caps.RegisterHandler(
351 "GetMesh",
352 new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh", agentID.ToString(), m_RedirectURL));
353=======
354// UUID capID = UUID.Random(); 335// UUID capID = UUID.Random();
355 if (m_URL == "localhost") 336 if (m_URL == "localhost")
356 { 337 {
@@ -375,34 +356,13 @@ namespace OpenSim.Region.ClientStack.Linden
375 caps.RegisterHandler("GetMesh", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); 356 caps.RegisterHandler("GetMesh", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
376 m_pollservices[agentID] = args; 357 m_pollservices[agentID] = args;
377 m_capsDict[agentID] = capUrl; 358 m_capsDict[agentID] = capUrl;
378
379
380
381>>>>>>> avn/ubitvar
382 } 359 }
383 else 360 else
384 { 361 {
385 caps.RegisterHandler("GetMesh", m_URL); 362 caps.RegisterHandler("GetMesh", m_URL);
386 } 363 }
387
388 if(m_URL2 == string.Empty)
389 {
390
391 }
392 else if (m_URL2 == "localhost")
393 {
394 if (!getMeshRegistered)
395 {
396 caps.RegisterHandler(
397 "GetMesh2",
398 new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh2", agentID.ToString(), m_RedirectURL2));
399 }
400 }
401 else
402 {
403 caps.RegisterHandler("GetMesh2", m_URL2);
404 }
405 } 364 }
365
406 private void DeregisterCaps(UUID agentID, Caps caps) 366 private void DeregisterCaps(UUID agentID, Caps caps)
407 { 367 {
408 string capUrl; 368 string capUrl;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index b9396b7..79a3458 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -82,24 +82,22 @@ namespace OpenSim.Region.ClientStack.Linden
82 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 82 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
83 new OpenMetaverse.BlockingQueue<aPollRequest>(); 83 new OpenMetaverse.BlockingQueue<aPollRequest>();
84 84
85<<<<<<< HEAD 85
86 // TODO: Change this to a config option 86 // TODO: Change this to a config option
87 private string m_RedirectURL = null; 87 private string m_RedirectURL = null;
88=======
89 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
90>>>>>>> avn/ubitvar
91 88
92 private string m_URL; 89 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
90
93 91
94 #region ISharedRegionModule Members 92 #region ISharedRegionModule Members
95 93
96 public void Initialise(IConfigSource source) 94 public void Initialise(IConfigSource source)
97 { 95 {
98 IConfig config = source.Configs["ClientStack.LindenCaps"]; 96 IConfig config = source.Configs["ClientStack.LindenCaps"];
99<<<<<<< HEAD 97
100 if (config == null) 98 if (config == null)
101 return; 99 return;
102 100/*
103 m_URL = config.GetString("Cap_GetTexture", string.Empty); 101 m_URL = config.GetString("Cap_GetTexture", string.Empty);
104 // Cap doesn't exist 102 // Cap doesn't exist
105 if (m_URL != string.Empty) 103 if (m_URL != string.Empty)
@@ -107,10 +105,8 @@ namespace OpenSim.Region.ClientStack.Linden
107 m_Enabled = true; 105 m_Enabled = true;
108 m_RedirectURL = config.GetString("GetTextureRedirectURL"); 106 m_RedirectURL = config.GetString("GetTextureRedirectURL");
109 } 107 }
110======= 108*/
111 if (config != null) 109 m_Url = config.GetString("Cap_GetTexture", "localhost");
112 m_Url = config.GetString("Cap_GetTexture", "localhost");
113>>>>>>> avn/ubitvar
114 } 110 }
115 111
116 public void AddRegion(Scene s) 112 public void AddRegion(Scene s)
@@ -142,7 +138,7 @@ namespace OpenSim.Region.ClientStack.Linden
142 138
143 for (uint i = 0; i < 2; i++) 139 for (uint i = 0; i < 2; i++)
144 { 140 {
145 m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests, 141 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
146 String.Format("TextureWorkerThread{0}", i), 142 String.Format("TextureWorkerThread{0}", i),
147 ThreadPriority.Normal, 143 ThreadPriority.Normal,
148 false, 144 false,
@@ -237,12 +233,6 @@ namespace OpenSim.Region.ClientStack.Linden
237 public PollServiceTextureEventArgs(UUID pId, Scene scene) : 233 public PollServiceTextureEventArgs(UUID pId, Scene scene) :
238 base(null, "", null, null, null, pId, int.MaxValue) 234 base(null, "", null, null, null, pId, int.MaxValue)
239 { 235 {
240<<<<<<< HEAD
241// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
242 caps.RegisterHandler(
243 "GetTexture",
244 new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString(), m_RedirectURL));
245=======
246 m_scene = scene; 236 m_scene = scene;
247 // x is request id, y is userid 237 // x is request id, y is userid
248 HasEvents = (x, y) => 238 HasEvents = (x, y) =>
@@ -312,7 +302,6 @@ namespace OpenSim.Region.ClientStack.Linden
312 302
313 return response; 303 return response;
314 }; 304 };
315>>>>>>> avn/ubitvar
316 } 305 }
317 306
318 public void Process(aPollRequest requestinfo) 307 public void Process(aPollRequest requestinfo)
@@ -402,11 +391,7 @@ namespace OpenSim.Region.ClientStack.Linden
402 } 391 }
403 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); 392 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
404 if (handler != null) 393 if (handler != null)
405<<<<<<< HEAD
406 handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture", m_URL);
407=======
408 handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl); 394 handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl);
409>>>>>>> avn/ubitvar
410 else 395 else
411 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); 396 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
412 m_pollservices[agentID] = args; 397 m_pollservices[agentID] = args;
@@ -422,7 +407,7 @@ namespace OpenSim.Region.ClientStack.Linden
422 { 407 {
423 PollServiceTextureEventArgs args; 408 PollServiceTextureEventArgs args;
424 409
425 MainServer.Instance.RemoveHTTPHandler("", m_URL); 410 MainServer.Instance.RemoveHTTPHandler("", m_Url);
426 m_capsDict.Remove(agentID); 411 m_capsDict.Remove(agentID);
427 412
428 if (m_pollservices.TryGetValue(agentID, out args)) 413 if (m_pollservices.TryGetValue(agentID, out args))
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 54542c9..d07f66e 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -157,11 +157,7 @@ namespace OpenSim.Region.ClientStack.Linden
157 m_features["MeshXferEnabled"] = true; 157 m_features["MeshXferEnabled"] = true;
158 158
159 m_features["PhysicsMaterialsEnabled"] = true; 159 m_features["PhysicsMaterialsEnabled"] = true;
160<<<<<<< HEAD
161 160
162=======
163
164>>>>>>> avn/ubitvar
165 OSDMap typesMap = new OSDMap(); 161 OSDMap typesMap = new OSDMap();
166 typesMap["convex"] = true; 162 typesMap["convex"] = true;
167 typesMap["none"] = true; 163 typesMap["none"] = true;
@@ -169,7 +165,6 @@ namespace OpenSim.Region.ClientStack.Linden
169 m_features["PhysicsShapeTypes"] = typesMap; 165 m_features["PhysicsShapeTypes"] = typesMap;
170 166
171 // Extra information for viewers that want to use it 167 // Extra information for viewers that want to use it
172<<<<<<< HEAD
173 // TODO: Take these out of here into their respective modules, like map-server-url 168 // TODO: Take these out of here into their respective modules, like map-server-url
174 OSDMap extrasMap; 169 OSDMap extrasMap;
175 if(m_features.ContainsKey("OpenSimExtras")) 170 if(m_features.ContainsKey("OpenSimExtras"))
@@ -179,15 +174,10 @@ namespace OpenSim.Region.ClientStack.Linden
179 else 174 else
180 extrasMap = new OSDMap(); 175 extrasMap = new OSDMap();
181 176
182=======
183
184 OSDMap extrasMap = new OSDMap();
185
186 extrasMap["AvatarSkeleton"] = true; 177 extrasMap["AvatarSkeleton"] = true;
187 extrasMap["AnimationSet"] = true; 178 extrasMap["AnimationSet"] = true;
188 179
189 // TODO: Take these out of here into their respective modules, like map-server-url 180 // TODO: Take these out of here into their respective modules, like map-server-url
190>>>>>>> avn/ubitvar
191 if (m_SearchURL != string.Empty) 181 if (m_SearchURL != string.Empty)
192 extrasMap["search-server-url"] = m_SearchURL; 182 extrasMap["search-server-url"] = m_SearchURL;
193 if (!string.IsNullOrEmpty(m_DestinationGuideURL)) 183 if (!string.IsNullOrEmpty(m_DestinationGuideURL))
@@ -199,13 +189,8 @@ namespace OpenSim.Region.ClientStack.Linden
199 if (m_GridName != string.Empty) 189 if (m_GridName != string.Empty)
200 extrasMap["GridName"] = m_GridName; 190 extrasMap["GridName"] = m_GridName;
201 191
202<<<<<<< HEAD
203 if (extrasMap.Count > 0) 192 if (extrasMap.Count > 0)
204 m_features["OpenSimExtras"] = extrasMap; 193 m_features["OpenSimExtras"] = extrasMap;
205=======
206 m_features["OpenSimExtras"] = extrasMap;
207
208>>>>>>> avn/ubitvar
209 } 194 }
210 } 195 }
211 196
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs
index dd4a691..db16ccb 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs
@@ -52,6 +52,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 52
53namespace OpenSim.Region.ClientStack.Linden.Caps.Tests 53namespace OpenSim.Region.ClientStack.Linden.Caps.Tests
54{ 54{
55 /*
55 [TestFixture] 56 [TestFixture]
56 public class WebFetchInvDescModuleTests : OpenSimTestCase 57 public class WebFetchInvDescModuleTests : OpenSimTestCase
57 { 58 {
@@ -156,4 +157,5 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests
156 Assert.That((int)folderOsd["descendents"], Is.EqualTo(16)); 157 Assert.That((int)folderOsd["descendents"], Is.EqualTo(16));
157 } 158 }
158 } 159 }
160 */
159} \ No newline at end of file 161} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
index c27d101..8fd8d1f 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -66,16 +66,19 @@ namespace OpenSim.Region.ClientStack.Linden
66 private bool m_persistBakedTextures; 66 private bool m_persistBakedTextures;
67 67
68 private IBakedTextureModule m_BakedTextureModule; 68 private IBakedTextureModule m_BakedTextureModule;
69 69 private string m_URL;
70 private IBakedTextureModule m_BakedTextureModule;
71 70
72 public void Initialise(IConfigSource source) 71 public void Initialise(IConfigSource source)
73 { 72 {
73 IConfig config = source.Configs["ClientStack.LindenCaps"];
74 if (config == null)
75 return;
76
77 m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
78
74 IConfig appearanceConfig = source.Configs["Appearance"]; 79 IConfig appearanceConfig = source.Configs["Appearance"];
75 if (appearanceConfig != null) 80 if (appearanceConfig != null)
76 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); 81 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
77
78
79 } 82 }
80 83
81 public void AddRegion(Scene s) 84 public void AddRegion(Scene s)
@@ -91,13 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden
91 s.EventManager.OnRemovePresence -= DeRegisterPresence; 94 s.EventManager.OnRemovePresence -= DeRegisterPresence;
92 m_BakedTextureModule = null; 95 m_BakedTextureModule = null;
93 m_scene = null; 96 m_scene = null;
94<<<<<<< HEAD
95 }
96=======
97 } 97 }
98>>>>>>> avn/ubitvar
99
100
101 98
102 public void RegionLoaded(Scene s) 99 public void RegionLoaded(Scene s)
103 { 100 {
@@ -109,173 +106,6 @@ namespace OpenSim.Region.ClientStack.Linden
109 106
110 private void DeRegisterPresence(UUID agentId) 107 private void DeRegisterPresence(UUID agentId)
111 { 108 {
112<<<<<<< HEAD
113 ScenePresence presence = null;
114 if (m_scene.TryGetScenePresence(agentId, out presence))
115 {
116 presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
117 }
118
119 }
120
121 private void RegisterNewPresence(ScenePresence presence)
122 {
123 presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
124
125 }
126
127 private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
128 {
129 int maxCacheitemsLoop = cacheItems.Length;
130 if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES)
131 {
132 maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
133 m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
134 }
135
136 m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
137 if (cacheItems.Length > 0)
138 {
139// m_log.Debug("[Cacheitems]: " + cacheItems.Length);
140// for (int iter = 0; iter < maxCacheitemsLoop; iter++)
141// {
142// m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
143// cacheItems[iter].TextureID);
144// }
145
146 ScenePresence p = null;
147 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
148 {
149
150 WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems;
151 if (existingitems == null)
152 {
153 if (m_BakedTextureModule != null)
154 {
155 WearableCacheItem[] savedcache = null;
156 try
157 {
158 if (p.Appearance.WearableCacheItemsDirty)
159 {
160 savedcache = m_BakedTextureModule.Get(p.UUID);
161 p.Appearance.WearableCacheItems = savedcache;
162 p.Appearance.WearableCacheItemsDirty = false;
163 }
164
165 }
166 /*
167 * The following Catch types DO NOT WORK with m_BakedTextureModule.Get
168 * it jumps to the General Packet Exception Handler if you don't catch Exception!
169 *
170 catch (System.Net.Sockets.SocketException)
171 {
172 cacheItems = null;
173 }
174 catch (WebException)
175 {
176 cacheItems = null;
177 }
178 catch (InvalidOperationException)
179 {
180 cacheItems = null;
181 } */
182 catch (Exception)
183 {
184 // The service logs a sufficient error message.
185 }
186
187
188 if (savedcache != null)
189 existingitems = savedcache;
190 }
191 }
192 // Existing items null means it's a fully new appearance
193 if (existingitems == null)
194 {
195
196 for (int i = 0; i < maxCacheitemsLoop; i++)
197 {
198 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
199 {
200 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
201 if (face == null)
202 {
203 textureEntry.CreateFace(cacheItems[i].TextureIndex);
204 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
205 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
206 continue;
207 }
208 cacheItems[i].TextureID =face.TextureID;
209 if (m_scene.AssetService != null)
210 cacheItems[i].TextureAsset =
211 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
212 }
213 else
214 {
215 m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
216 }
217
218
219 }
220 }
221 else
222
223
224 {
225 // for each uploaded baked texture
226 for (int i = 0; i < maxCacheitemsLoop; i++)
227 {
228 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
229 {
230 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
231 if (face == null)
232 {
233 textureEntry.CreateFace(cacheItems[i].TextureIndex);
234 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
235 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
236 continue;
237 }
238 cacheItems[i].TextureID =
239 face.TextureID;
240 }
241 else
242 {
243 m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
244 }
245 }
246
247 for (int i = 0; i < maxCacheitemsLoop; i++)
248 {
249 if (cacheItems[i].TextureAsset == null)
250 {
251 cacheItems[i].TextureAsset =
252 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
253 }
254 }
255 }
256
257
258
259 p.Appearance.WearableCacheItems = cacheItems;
260
261
262
263 if (m_BakedTextureModule != null)
264 {
265 m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems);
266 p.Appearance.WearableCacheItemsDirty = true;
267
268 }
269 }
270 }
271=======
272// ScenePresence presence = null;
273// if (m_scene.TryGetScenePresence(agentId, out presence))
274 {
275// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
276 }
277
278>>>>>>> avn/ubitvar
279 } 109 }
280 110
281 private void RegisterNewPresence(ScenePresence presence) 111 private void RegisterNewPresence(ScenePresence presence)
@@ -441,25 +271,6 @@ namespace OpenSim.Region.ClientStack.Linden
441 271
442 public void RegisterCaps(UUID agentID, Caps caps) 272 public void RegisterCaps(UUID agentID, Caps caps)
443 { 273 {
444 UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
445 caps, m_scene.AssetService, m_persistBakedTextures);
446
447<<<<<<< HEAD
448
449
450 caps.RegisterHandler(
451 "UploadBakedTexture",
452 new RestStreamHandler(
453 "POST",
454 "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
455 avatarhandler.UploadBakedTexture,
456 "UploadBakedTexture",
457 agentID.ToString()));
458
459
460
461
462=======
463 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 274 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
464 if (m_URL == "localhost") 275 if (m_URL == "localhost")
465 { 276 {
@@ -480,7 +291,6 @@ namespace OpenSim.Region.ClientStack.Linden
480 { 291 {
481 caps.RegisterHandler("UploadBakedTexture", m_URL); 292 caps.RegisterHandler("UploadBakedTexture", m_URL);
482 } 293 }
483>>>>>>> avn/ubitvar
484 } 294 }
485 } 295 }
486} 296}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 92f8c51..6e2f7f3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -64,11 +64,7 @@ namespace OpenSim.Region.ClientStack.Linden
64 public List<UUID> folders; 64 public List<UUID> folders;
65 } 65 }
66 66
67<<<<<<< HEAD
68 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
69=======
70 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
71>>>>>>> avn/ubitvar
72 68
73 /// <summary> 69 /// <summary>
74 /// Control whether requests will be processed asynchronously. 70 /// Control whether requests will be processed asynchronously.
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 806269f..f76db1e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -723,11 +723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
723 if (!m_packetHandlers.ContainsKey(packetType)) 723 if (!m_packetHandlers.ContainsKey(packetType))
724 { 724 {
725 m_packetHandlers.Add( 725 m_packetHandlers.Add(
726<<<<<<< HEAD
727 packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine }); 726 packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine });
728=======
729 packetType, new PacketProcessor() { method = handler, Async = doAsync });
730>>>>>>> avn/ubitvar
731 result = true; 727 result = true;
732 } 728 }
733 } 729 }
@@ -1228,15 +1224,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1228 /// <param name="map">heightmap</param> 1224 /// <param name="map">heightmap</param>
1229 public virtual void SendLayerData(float[] map) 1225 public virtual void SendLayerData(float[] map)
1230 { 1226 {
1231<<<<<<< HEAD
1232 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData"); 1227 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData");
1233=======
1234 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData());
1235 1228
1236 // Send it sync, and async. It's not that much data 1229 // Send it sync, and async. It's not that much data
1237 // and it improves user experience just so much! 1230 // and it improves user experience just so much!
1238// DoSendLayerData(map); 1231// DoSendLayerData(map);
1239>>>>>>> avn/ubitvar
1240 } 1232 }
1241 1233
1242 /// <summary> 1234 /// <summary>
@@ -1250,18 +1242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1250 try 1242 try
1251 { 1243 {
1252 // Send LayerData in typerwriter pattern 1244 // Send LayerData in typerwriter pattern
1253<<<<<<< HEAD 1245
1254 //for (int y = 0; y < 16; y++)
1255 //{
1256 // for (int x = 0; x < 16; x++)
1257 // {
1258 // SendLayerData(x, y, map);
1259 // }
1260 //}
1261
1262 // Send LayerData in a spiral pattern. Fun!
1263 SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1);
1264=======
1265 for (int y = 0; y < 16; y++) 1246 for (int y = 0; y < 16; y++)
1266 { 1247 {
1267 for (int x = 0; x < 16; x++) 1248 for (int x = 0; x < 16; x++)
@@ -1269,7 +1250,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1269 SendLayerData(x, y, map); 1250 SendLayerData(x, y, map);
1270 } 1251 }
1271 } 1252 }
1272>>>>>>> avn/ubitvar
1273 } 1253 }
1274 catch (Exception e) 1254 catch (Exception e)
1275 { 1255 {
@@ -1277,74 +1257,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1277 } 1257 }
1278 } 1258 }
1279 1259
1280<<<<<<< HEAD
1281 private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
1282=======
1283 // Legacy form of invocation that passes around a bare data array.
1284 // Just ignore what was passed and use the real terrain info that is part of the scene.
1285 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
1286 // there is a special form for specifying multiple terrain patches to send.
1287 // The form is to pass 'px' as negative the number of patches to send and to
1288 // pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
1289 // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
1290 // and the patches to send are <3,5> and <8,4>.
1291 public void SendLayerData(int px, int py, float[] map)
1292>>>>>>> avn/ubitvar
1293 {
1294 if (px >= 0)
1295 {
1296 SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
1297 }
1298 else
1299 {
1300 int numPatches = -px;
1301 int[] xPatches = new int[numPatches];
1302 int[] yPatches = new int[numPatches];
1303 for (int pp = 0; pp < numPatches; pp++)
1304 {
1305 xPatches[pp] = (int)map[pp * 2];
1306 yPatches[pp] = (int)map[pp * 2 + 1];
1307 }
1308
1309 // DebugSendingPatches("SendLayerData", xPatches, yPatches);
1310
1311<<<<<<< HEAD
1312 if (x2 - x1 > 0 && y2 - y1 > 0)
1313 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1314 }
1315
1316 void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
1317 {
1318 // Row in reverse
1319 for (int i = x2; i >= x1; i--)
1320 SendLayerData(i, y2, map);
1321
1322 // Column in reverse
1323 for (int j = y2 - 1; j >= y1; j--)
1324 SendLayerData(x1, j, map);
1325
1326 if (x2 - x1 > 0 && y2 - y1 > 0)
1327 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1328 }
1329
1330 /// <summary>
1331 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1332 /// </summary>
1333 /// <param name="map">heightmap</param>
1334 /// <param name="px">X coordinate for patches 0..12</param>
1335 /// <param name="py">Y coordinate for patches 0..15</param>
1336 // private void SendLayerPacket(float[] map, int y, int x)
1337 // {
1338 // int[] patches = new int[4];
1339 // patches[0] = x + 0 + y * 16;
1340 // patches[1] = x + 1 + y * 16;
1341 // patches[2] = x + 2 + y * 16;
1342 // patches[3] = x + 3 + y * 16;
1343
1344 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
1345 // OutPacket(layerpack, ThrottleOutPacketType.Land);
1346 // }
1347
1348 // Legacy form of invocation that passes around a bare data array. 1260 // Legacy form of invocation that passes around a bare data array.
1349 // Just ignore what was passed and use the real terrain info that is part of the scene. 1261 // Just ignore what was passed and use the real terrain info that is part of the scene.
1350 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, 1262 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
@@ -1393,29 +1305,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1393 } 1305 }
1394 1306
1395 /// <summary> 1307 /// <summary>
1396=======
1397 SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
1398 }
1399 }
1400 1308
1401 private void DebugSendingPatches(string pWho, int[] pX, int[] pY)
1402 {
1403 if (m_log.IsDebugEnabled)
1404 {
1405 int numPatches = pX.Length;
1406 string Xs = "";
1407 string Ys = "";
1408 for (int pp = 0; pp < numPatches; pp++)
1409 {
1410 Xs += String.Format("{0}", (int)pX[pp]) + ",";
1411 Ys += String.Format("{0}", (int)pY[pp]) + ",";
1412 }
1413 m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys);
1414 }
1415 }
1416
1417 /// <summary>
1418>>>>>>> avn/ubitvar
1419 /// Sends a terrain packet for the point specified. 1309 /// Sends a terrain packet for the point specified.
1420 /// This is a legacy call that has refarbed the terrain into a flat map of floats. 1310 /// This is a legacy call that has refarbed the terrain into a flat map of floats.
1421 /// We just use the terrain from the region we know about. 1311 /// We just use the terrain from the region we know about.
@@ -1467,40 +1357,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1467 } 1357 }
1468 } 1358 }
1469 1359
1470<<<<<<< HEAD
1471 // When a user edits the terrain, so much data is sent, the data queues up fast and presents a
1472 // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we
1473 // start skipping the queues until they're done editing the terrain. We also make them
1474 // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch
1475 // area invalidating previous packets for that area.
1476
1477 // It's possible for an editing user to flood themselves with edited packets but the majority
1478 // of use cases are such that only a tiny percentage of users will be editing the terrain.
1479 // Other, non-editing users will see the edits much slower.
1480
1481 // One last note on this topic, by the time users are going to be editing the terrain, it's
1482 // extremely likely that the sim will have rezzed already and therefore this is not likely going
1483 // to cause any additional issues with lost packets, objects or terrain patches.
1484
1485 // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we
1486 // only have one cache miss.
1487 private void SendTheLayerPacket(LayerDataPacket layerpack) 1360 private void SendTheLayerPacket(LayerDataPacket layerpack)
1488 { 1361 {
1489 if (m_justEditedTerrain)
1490 {
1491 layerpack.Header.Reliable = false;
1492 OutPacket(layerpack, ThrottleOutPacketType.Unknown );
1493 }
1494 else
1495 {
1496 layerpack.Header.Reliable = true;
1497 OutPacket(layerpack, ThrottleOutPacketType.Land);
1498 }
1499=======
1500 private void SendTheLayerPacket(LayerDataPacket layerpack)
1501 {
1502 OutPacket(layerpack, ThrottleOutPacketType.Land); 1362 OutPacket(layerpack, ThrottleOutPacketType.Land);
1503>>>>>>> avn/ubitvar
1504 } 1363 }
1505 1364
1506 /// <summary> 1365 /// <summary>
@@ -2490,15 +2349,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2490 { 2349 {
2491 if (agentid == AgentId) 2350 if (agentid == AgentId)
2492 { 2351 {
2493<<<<<<< HEAD
2494 ActiveGroupId = activegroupid; 2352 ActiveGroupId = activegroupid;
2495 ActiveGroupName = groupname; 2353 ActiveGroupName = groupname;
2496 ActiveGroupPowers = grouppowers; 2354 ActiveGroupPowers = grouppowers;
2497=======
2498 m_activeGroupID = activegroupid;
2499 m_activeGroupName = groupname;
2500 m_activeGroupPowers = grouppowers;
2501>>>>>>> avn/ubitvar
2502 } 2355 }
2503 2356
2504 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); 2357 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
@@ -3888,15 +3741,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3888 avp.Sender.IsTrial = false; 3741 avp.Sender.IsTrial = false;
3889 avp.Sender.ID = agentID; 3742 avp.Sender.ID = agentID;
3890 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; 3743 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
3891<<<<<<< HEAD
3892 avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; 3744 avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0];
3893=======
3894 3745
3895 // this need be use in future 3746// this need be use in future ?
3896 // avp.AppearanceData[0].AppearanceVersion = 0; 3747// avp.AppearanceData[0].AppearanceVersion = 0;
3897 // avp.AppearanceData[0].CofVersion = 0; 3748// avp.AppearanceData[0].CofVersion = 0;
3898 3749
3899>>>>>>> avn/ubitvar
3900 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3750 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3901 OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); 3751 OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3902 } 3752 }
@@ -4014,22 +3864,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4014 /// </summary> 3864 /// </summary>
4015 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3865 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
4016 { 3866 {
4017<<<<<<< HEAD
4018 if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 3867 if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
4019 { 3868 {
4020 ImprovedTerseObjectUpdatePacket packet 3869 ImprovedTerseObjectUpdatePacket packet
4021 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 3870 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4022=======
4023 if (entity is SceneObjectPart)
4024 {
4025 SceneObjectPart e = (SceneObjectPart)entity;
4026 SceneObjectGroup g = e.ParentGroup;
4027 if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
4028 return; // Don't send updates for other people's HUDs
4029 }
4030
4031 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
4032>>>>>>> avn/ubitvar
4033 3871
4034 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3872 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4035 packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f); 3873 packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f);
@@ -4037,6 +3875,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4037 packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false); 3875 packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false);
4038 OutPacket(packet, ThrottleOutPacketType.Unknown, true); 3876 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
4039 } 3877 }
3878
3879 else if (entity is SceneObjectPart)
3880 {
3881 SceneObjectPart e = (SceneObjectPart)entity;
3882 SceneObjectGroup g = e.ParentGroup;
3883 if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
3884 return; // Don't send updates for other people's HUDs
3885 }
3886
4040 else 3887 else
4041 { 3888 {
4042 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 3889 //double priority = m_prioritizer.GetUpdatePriority(this, entity);
@@ -4385,15 +4232,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4385 4232
4386 OutPacket(packet, ThrottleOutPacketType.Task, true); 4233 OutPacket(packet, ThrottleOutPacketType.Task, true);
4387 } 4234 }
4388<<<<<<< HEAD
4389 4235
4390// m_log.DebugFormat( 4236// m_log.DebugFormat(
4391// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}", 4237// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
4392// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); 4238// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
4393// 4239//
4394 #endregion Packet Sending
4395=======
4396>>>>>>> avn/ubitvar
4397 } 4240 }
4398 4241
4399 public void ReprioritizeUpdates() 4242 public void ReprioritizeUpdates()
@@ -5360,11 +5203,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5360 { 5203 {
5361 ScenePresence presence = (ScenePresence)entity; 5204 ScenePresence presence = (ScenePresence)entity;
5362 5205
5363<<<<<<< HEAD
5364// m_log.DebugFormat(
5365// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}",
5366// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name);
5367=======
5368 position = presence.OffsetPosition; 5206 position = presence.OffsetPosition;
5369 rotation = presence.Rotation; 5207 rotation = presence.Rotation;
5370 angularVelocity = presence.AngularVelocity; 5208 angularVelocity = presence.AngularVelocity;
@@ -5373,7 +5211,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5373 attachPoint = 0; 5211 attachPoint = 0;
5374// m_log.DebugFormat( 5212// m_log.DebugFormat(
5375// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); 5213// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
5376>>>>>>> avn/ubitvar
5377 5214
5378 // attachPoint = presence.State; // Core: commented 5215 // attachPoint = presence.State; // Core: commented
5379 collisionPlane = presence.CollisionPlane; 5216 collisionPlane = presence.CollisionPlane;
@@ -5495,24 +5332,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5495// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); 5332// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name);
5496 5333
5497 byte[] objectData = new byte[76]; 5334 byte[] objectData = new byte[76];
5498<<<<<<< HEAD
5499
5500 data.CollisionPlane.ToBytes(objectData, 0);
5501 data.OffsetPosition.ToBytes(objectData, 16);
5502 data.Velocity.ToBytes(objectData, 28);
5503// data.Acceleration.ToBytes(objectData, 40);
5504
5505 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
5506 // it rotates around.
5507 // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted
5508 // excessive up and down movements of the camera when looking up and down.
5509 // See http://opensimulator.org/mantis/view.php?id=3274
5510 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5511 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
5512 // the rotation in this case.
5513 Quaternion rot = data.Rotation;
5514=======
5515>>>>>>> avn/ubitvar
5516 5335
5517 Vector3 velocity = new Vector3(0, 0, 0); 5336 Vector3 velocity = new Vector3(0, 0, 0);
5518 Vector3 acceleration = new Vector3(0, 0, 0); 5337 Vector3 acceleration = new Vector3(0, 0, 0);
@@ -5596,11 +5415,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5596 //update.JointType = 0; 5415 //update.JointType = 0;
5597 update.Material = data.Material; 5416 update.Material = data.Material;
5598 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 5417 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
5599<<<<<<< HEAD
5600
5601=======
5602/* 5418/*
5603>>>>>>> avn/ubitvar
5604 if (data.ParentGroup.IsAttachment) 5419 if (data.ParentGroup.IsAttachment)
5605 { 5420 {
5606 update.NameValue 5421 update.NameValue
@@ -5625,7 +5440,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5625 // case for attachments may contain conflicting values that can end up crashing the viewer. 5440 // case for attachments may contain conflicting values that can end up crashing the viewer.
5626 update.State = data.ParentGroup.RootPart.Shape.State; 5441 update.State = data.ParentGroup.RootPart.Shape.State;
5627 } 5442 }
5628 */ 5443*/
5629 5444
5630 if (data.ParentGroup.IsAttachment) 5445 if (data.ParentGroup.IsAttachment)
5631 { 5446 {
@@ -9365,11 +9180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9365 if ((locX >= m_scene.RegionInfo.WorldLocX) 9180 if ((locX >= m_scene.RegionInfo.WorldLocX)
9366 && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) 9181 && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX))
9367 && (locY >= m_scene.RegionInfo.WorldLocY) 9182 && (locY >= m_scene.RegionInfo.WorldLocY)
9368<<<<<<< HEAD
9369 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) )
9370=======
9371 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY))) 9183 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)))
9372>>>>>>> avn/ubitvar
9373 { 9184 {
9374 tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; 9185 tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle;
9375 tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; 9186 tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX;
@@ -12285,7 +12096,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12285 /// <param name="packet"></param> 12096 /// <param name="packet"></param>
12286 /// <returns></returns> 12097 /// <returns></returns>
12287 // TODO: Convert old handler to use new method 12098 // TODO: Convert old handler to use new method
12288 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 12099/*
12100 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
12289 { 12101 {
12290 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 12102 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
12291 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 12103 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
@@ -12340,27 +12152,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12340 } 12152 }
12341 } 12153 }
12342 12154
12343<<<<<<< HEAD
12344 if (cacheItems != null)
12345 {
12346 // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
12347 // Copy the baked textures to the sim's assets cache (local only).
12348 foreach (WearableCacheItem item in cacheItems)
12349 {
12350 if (cache.GetCached(item.TextureID.ToString()) == null)
12351 {
12352 item.TextureAsset.Temporary = true;
12353 item.TextureAsset.Local = true;
12354 cache.Store(item.TextureAsset);
12355 }
12356 }
12357
12358 // Return the cached textures
12359 for (int i = 0; i < maxWearablesLoop; i++)
12360 {
12361 WearableCacheItem item =
12362 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
12363=======
12364 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; 12155 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
12365 if (handlerCachedTextureRequest != null) 12156 if (handlerCachedTextureRequest != null)
12366 { 12157 {
@@ -12368,7 +12159,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12368 } 12159 }
12369 12160
12370 return true; 12161 return true;
12371 }*/ 12162 }
12163*/
12372 12164
12373 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 12165 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
12374 { 12166 {
@@ -12408,21 +12200,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12408 for (int i = 0; i < maxWearablesLoop; i++) 12200 for (int i = 0; i < maxWearablesLoop; i++)
12409 { 12201 {
12410 int idx = cachedtex.WearableData[i].TextureIndex; 12202 int idx = cachedtex.WearableData[i].TextureIndex;
12411>>>>>>> avn/ubitvar
12412
12413 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12203 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12414 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12204 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12415 cachedresp.WearableData[i].HostName = new byte[0]; 12205 cachedresp.WearableData[i].HostName = new byte[0];
12416<<<<<<< HEAD
12417 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
12418 {
12419 cachedresp.WearableData[i].TextureID = item.TextureID;
12420=======
12421 if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) 12206 if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
12422 { 12207 {
12423 cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; 12208 cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
12424 cacheHits++; 12209 cacheHits++;
12425>>>>>>> avn/ubitvar
12426 } 12210 }
12427 else 12211 else
12428 { 12212 {
@@ -12432,29 +12216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12432 } 12216 }
12433 else 12217 else
12434 { 12218 {
12435<<<<<<< HEAD
12436 // Cached textures not available
12437=======
12438>>>>>>> avn/ubitvar
12439 for (int i = 0; i < maxWearablesLoop; i++) 12219 for (int i = 0; i < maxWearablesLoop; i++)
12440 { 12220 {
12441 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12221 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12442 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12222 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12443 cachedresp.WearableData[i].TextureID = UUID.Zero; 12223 cachedresp.WearableData[i].TextureID = UUID.Zero;
12444<<<<<<< HEAD
12445 cachedresp.WearableData[i].HostName = new byte[0];
12446 }
12447 }
12448
12449=======
12450 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12451 cachedresp.WearableData[i].HostName = new byte[0]; 12224 cachedresp.WearableData[i].HostName = new byte[0];
12452 } 12225 }
12453 } 12226 }
12454 12227
12455 m_log.DebugFormat("texture cached: hits {0}", cacheHits); 12228 m_log.DebugFormat("texture cached: hits {0}", cacheHits);
12456 12229
12457>>>>>>> avn/ubitvar
12458 cachedresp.Header.Zerocoded = true; 12230 cachedresp.Header.Zerocoded = true;
12459 OutPacket(cachedresp, ThrottleOutPacketType.Task); 12231 OutPacket(cachedresp, ThrottleOutPacketType.Task);
12460 12232
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index 9293882..86a7188 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -96,9 +96,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
96 set 96 set
97 { 97 {
98 m_throttleDebugLevel = value; 98 m_throttleDebugLevel = value;
99/*
99 m_throttleClient.DebugLevel = m_throttleDebugLevel; 100 m_throttleClient.DebugLevel = m_throttleDebugLevel;
100 foreach (TokenBucket tb in m_throttleCategories) 101 foreach (TokenBucket tb in m_throttleCategories)
101 tb.DebugLevel = m_throttleDebugLevel; 102 tb.DebugLevel = m_throttleDebugLevel;
103 */
102 } 104 }
103 } 105 }
104 private int m_throttleDebugLevel; 106 private int m_throttleDebugLevel;
@@ -250,22 +252,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
250 if (maxRTO != 0) 252 if (maxRTO != 0)
251 m_maxRTO = maxRTO; 253 m_maxRTO = maxRTO;
252 254
253<<<<<<< HEAD
254 ProcessUnackedSends = true;
255
256 // Create a token bucket throttle for this client that has the scene token bucket as a parent
257 m_throttleClient
258 = new AdaptiveTokenBucket(
259 string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name),
260 parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled);
261
262=======
263 m_burstTime = rates.BrustTime; 255 m_burstTime = rates.BrustTime;
264 float m_burst = rates.ClientMaxRate * m_burstTime; 256 float m_burst = rates.ClientMaxRate * m_burstTime;
265 257
266 // Create a token bucket throttle for this client that has the scene token bucket as a parent 258 // Create a token bucket throttle for this client that has the scene token bucket as a parent
267 m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled); 259 m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled);
268>>>>>>> avn/ubitvar 260
269 // Create an array of token buckets for this clients different throttle categories 261 // Create an array of token buckets for this clients different throttle categories
270 m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; 262 m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
271 263
@@ -278,19 +270,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
278 ThrottleOutPacketType type = (ThrottleOutPacketType)i; 270 ThrottleOutPacketType type = (ThrottleOutPacketType)i;
279 271
280 // Initialize the packet outboxes, where packets sit while they are waiting for tokens 272 // Initialize the packet outboxes, where packets sit while they are waiting for tokens
281<<<<<<< HEAD
282 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
283
284 // Initialize the token buckets that control the throttling for each category
285 m_throttleCategories[i]
286 = new TokenBucket(
287 string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name),
288 m_throttleClient, rates.GetRate(type), 0);
289=======
290 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); 273 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
291 // Initialize the token buckets that control the throttling for each category 274 // Initialize the token buckets that control the throttling for each category
292 m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); 275 m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst);
293>>>>>>> avn/ubitvar
294 } 276 }
295 277
296 // Default the retransmission timeout to one second 278 // Default the retransmission timeout to one second
@@ -337,12 +319,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
337 m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; 319 m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
338 m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; 320 m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
339 m_info.totalThrottle = (int)m_throttleClient.DripRate; 321 m_info.totalThrottle = (int)m_throttleClient.DripRate;
340<<<<<<< HEAD
341 m_info.targetThrottle = (int)m_throttleClient.TargetDripRate;
342 m_info.maxThrottle = (int)m_throttleClient.MaxDripRate;
343=======
344>>>>>>> avn/ubitvar
345
346 return m_info; 322 return m_info;
347 } 323 }
348 324
@@ -460,13 +436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
460 int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; 436 int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
461 int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); 437 int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale);
462 438
463 if (ThrottleDebugLevel > 0) 439
464 {
465 long total = resend + land + wind + cloud + task + texture + asset;
466 m_log.DebugFormat(
467 "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
468 AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
469 }
470 440
471 // Make sure none of the throttles are set below our packet MTU, 441 // Make sure none of the throttles are set below our packet MTU,
472 // otherwise a throttle could become permanently clogged 442 // otherwise a throttle could become permanently clogged
@@ -486,32 +456,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
486 // the task queue (e.g. object updates) 456 // the task queue (e.g. object updates)
487 task = task + (int)(m_cannibalrate * texture); 457 task = task + (int)(m_cannibalrate * texture);
488 texture = (int)((1 - m_cannibalrate) * texture); 458 texture = (int)((1 - m_cannibalrate) * texture);
489<<<<<<< HEAD
490
491 //int total = resend + land + wind + cloud + task + texture + asset;
492
493 if (ThrottleDebugLevel > 0)
494 {
495 long total = resend + land + wind + cloud + task + texture + asset;
496 m_log.DebugFormat(
497 "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
498 AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
499 }
500=======
501 459
502 int total = resend + land + wind + cloud + task + texture + asset; 460 int total = resend + land + wind + cloud + task + texture + asset;
503 461
504 float m_burst = total * m_burstTime; 462 float m_burst = total * m_burstTime;
505 463
506 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", 464 if (ThrottleDebugLevel > 0)
507 // AgentID, resend, land, wind, cloud, task, texture, asset, total);
508>>>>>>> avn/ubitvar
509
510 // Update the token buckets with new throttle values
511 if (m_throttleClient.AdaptiveEnabled)
512 { 465 {
513 long total = resend + land + wind + cloud + task + texture + asset; 466 m_log.DebugFormat(
514 m_throttleClient.TargetDripRate = total; 467 "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
468 AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
515 } 469 }
516 470
517 TokenBucket bucket; 471 TokenBucket bucket;
@@ -887,20 +841,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
887 /// signature</param> 841 /// signature</param>
888 public void FireQueueEmpty(object o) 842 public void FireQueueEmpty(object o)
889 { 843 {
890<<<<<<< HEAD
891// m_log.DebugFormat("[LLUDPCLIENT]: FireQueueEmpty for {0} in {1}", AgentID, m_udpServer.Scene.Name);
892
893// int start = Environment.TickCount & Int32.MaxValue;
894// const int MIN_CALLBACK_MS = 30;
895
896// if (m_udpServer.IsRunningOutbound)
897// {
898 ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
899 QueueEmpty callback = OnQueueEmpty;
900=======
901 ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; 844 ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
902 QueueEmpty callback = OnQueueEmpty; 845 QueueEmpty callback = OnQueueEmpty;
903>>>>>>> avn/ubitvar
904 846
905 if (callback != null) 847 if (callback != null)
906 { 848 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 41e19fd..cb05e8f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -473,17 +473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
473 } 473 }
474 #endregion BinaryStats 474 #endregion BinaryStats
475 475
476<<<<<<< HEAD 476 Throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f);
477 // FIXME: Can't add info here because don't know scene yet.
478// m_throttle
479// = new TokenBucket(
480// string.Format("server throttle bucket for {0}", Scene.Name), null, sceneThrottleBps);
481
482 Throttle = new TokenBucket("server throttle bucket", null, 0, sceneThrottleBps);
483
484=======
485 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f);
486>>>>>>> avn/ubitvar
487 ThrottleRates = new ThrottleRates(configSource); 477 ThrottleRates = new ThrottleRates(configSource);
488 478
489 Random rnd = new Random(Util.EnvironmentTickCount()); 479 Random rnd = new Random(Util.EnvironmentTickCount());
@@ -784,151 +774,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
784 if (UsePools) 774 if (UsePools)
785 EnablePoolStats(); 775 EnablePoolStats();
786 776
787<<<<<<< HEAD 777
788 LLUDPServerCommands commands = new LLUDPServerCommands(MainConsole.Instance, this); 778 LLUDPServerCommands commands = new LLUDPServerCommands(MainConsole.Instance, this);
789 commands.Register(); 779 commands.Register();
790=======
791 MainConsole.Instance.Commands.AddCommand(
792 "Debug", false, "debug lludp packet",
793 "debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
794 "Turn on packet debugging",
795 "If level > 255 then all incoming and outgoing packets are logged.\n"
796 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
797 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
798 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
799 + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
800 + "If level <= 0 then no packets are logged.\n"
801 + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
802 + "In this case, you cannot also specify an avatar name.\n"
803 + "If an avatar name is given then only packets from that avatar are logged.",
804 HandlePacketCommand);
805
806 MainConsole.Instance.Commands.AddCommand(
807 "Debug",
808 false,
809 "debug lludp start",
810 "debug lludp start <in|out|all>",
811 "Control LLUDP packet processing.",
812 "No effect if packet processing has already started.\n"
813 + "in - start inbound processing.\n"
814 + "out - start outbound processing.\n"
815 + "all - start in and outbound processing.\n",
816 HandleStartCommand);
817
818 MainConsole.Instance.Commands.AddCommand(
819 "Debug",
820 false,
821 "debug lludp stop",
822 "debug lludp stop <in|out|all>",
823 "Stop LLUDP packet processing.",
824 "No effect if packet processing has already stopped.\n"
825 + "in - stop inbound processing.\n"
826 + "out - stop outbound processing.\n"
827 + "all - stop in and outbound processing.\n",
828 HandleStopCommand);
829
830 MainConsole.Instance.Commands.AddCommand(
831 "Debug",
832 false,
833 "debug lludp pool",
834 "debug lludp pool <on|off>",
835 "Turn object pooling within the lludp component on or off.",
836 HandlePoolCommand);
837
838 MainConsole.Instance.Commands.AddCommand(
839 "Debug",
840 false,
841 "debug lludp status",
842 "debug lludp status",
843 "Return status of LLUDP packet processing.",
844 HandleStatusCommand);
845/* disabled
846 MainConsole.Instance.Commands.AddCommand(
847 "Debug",
848 false,
849 "debug lludp toggle agentupdate",
850 "debug lludp toggle agentupdate",
851 "Toggle whether agentupdate packets are processed or simply discarded.",
852 HandleAgentUpdateCommand);
853 */
854 }
855
856 private void HandlePacketCommand(string module, string[] args)
857 {
858 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
859 return;
860
861 bool setAsDefaultLevel = false;
862 OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null);
863 List<string> filteredArgs = optionSet.Parse(args);
864
865 string name = null;
866
867 if (filteredArgs.Count == 6)
868 {
869 if (!setAsDefaultLevel)
870 {
871 name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]);
872 }
873 else
874 {
875 MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level");
876 return;
877 }
878 }
879
880 if (filteredArgs.Count > 3)
881 {
882 int newDebug;
883 if (int.TryParse(filteredArgs[3], out newDebug))
884 {
885 if (setAsDefaultLevel)
886 {
887 DefaultClientPacketDebugLevel = newDebug;
888 MainConsole.Instance.OutputFormat(
889 "Debug packet debug for new clients set to {0} in {1}", DefaultClientPacketDebugLevel, m_scene.Name);
890 }
891 else
892 {
893 m_scene.ForEachScenePresence(sp =>
894 {
895 if (name == null || sp.Name == name)
896 {
897 MainConsole.Instance.OutputFormat(
898 "Packet debug for {0} ({1}) set to {2} in {3}",
899 sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name);
900
901 sp.ControllingClient.DebugPacketLevel = newDebug;
902 }
903 });
904 }
905 }
906 else
907 {
908 MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [<first-name> <last-name>]");
909 }
910 }
911 }
912 780
913 private void HandleStartCommand(string module, string[] args)
914 {
915 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
916 return;
917
918 if (args.Length != 4)
919 {
920 MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
921 return;
922 }
923
924 string subCommand = args[3];
925
926 if (subCommand == "in" || subCommand == "all")
927 StartInbound();
928
929 if (subCommand == "out" || subCommand == "all")
930 StartOutbound();
931>>>>>>> avn/ubitvar
932 } 781 }
933 782
934 public bool HandlesRegion(Location x) 783 public bool HandlesRegion(Location x)
@@ -1126,36 +975,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1126 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will 975 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
1127 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 976 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
1128 // packet so that it isn't sent before a queued update packet. 977 // packet so that it isn't sent before a queued update packet.
1129<<<<<<< HEAD
1130 bool forceQueue = (type == PacketType.KillObject);
1131 978
1132// if (type == PacketType.ImprovedTerseObjectUpdate)
1133// {
1134// m_log.DebugFormat("Direct send ITOU to {0} in {1}", udpClient.AgentID, Scene.Name);
1135// SendPacketFinal(outgoingPacket);
1136// return false;
1137// }
1138// else
1139// {
1140 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forceQueue))
1141=======
1142 bool requestQueue = type == PacketType.KillObject; 979 bool requestQueue = type == PacketType.KillObject;
1143 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) 980 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
1144>>>>>>> avn/ubitvar
1145 { 981 {
1146 SendPacketFinal(outgoingPacket); 982 SendPacketFinal(outgoingPacket);
1147 return true; 983 return true;
1148 } 984 }
1149<<<<<<< HEAD
1150 else
1151 {
1152 return false;
1153 }
1154// }
1155=======
1156 985
1157 return false; 986 return false;
1158>>>>>>> avn/ubitvar
1159 987
1160 #endregion Queue or Send 988 #endregion Queue or Send
1161 } 989 }
@@ -1462,7 +1290,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1462 1290
1463 // If there is already a client for this endpoint, don't process UseCircuitCode 1291 // If there is already a client for this endpoint, don't process UseCircuitCode
1464 IClientAPI client = null; 1292 IClientAPI client = null;
1465 if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) 1293 if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
1466 { 1294 {
1467 // UseCircuitCode handling 1295 // UseCircuitCode handling
1468 if (packet.Type == PacketType.UseCircuitCode) 1296 if (packet.Type == PacketType.UseCircuitCode)
@@ -1473,12 +1301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1473 if (m_pendingCache.Contains(endPoint)) 1301 if (m_pendingCache.Contains(endPoint))
1474 return; 1302 return;
1475 1303
1476<<<<<<< HEAD
1477 Util.FireAndForget(HandleUseCircuitCode, array, "LLUDPServer.HandleUseCircuitCode");
1478=======
1479 m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60); 1304 m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60);
1480 } 1305 }
1481>>>>>>> avn/ubitvar
1482 1306
1483 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the 1307 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
1484 // buffer. 1308 // buffer.
@@ -1507,14 +1331,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1507 // Send ack straight away to let the viewer know that we got it. 1331 // Send ack straight away to let the viewer know that we got it.
1508 SendAckImmediate(endPoint, packet.Header.Sequence); 1332 SendAckImmediate(endPoint, packet.Header.Sequence);
1509 1333
1510<<<<<<< HEAD
1511 Util.FireAndForget(
1512 HandleCompleteMovementIntoRegion, array, "LLUDPServer.HandleCompleteMovementIntoRegion");
1513=======
1514 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the 1334 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
1515 // buffer. 1335 // buffer.
1516 object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; 1336 object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
1517>>>>>>> avn/ubitvar
1518 1337
1519 Util.FireAndForget(HandleCompleteMovementIntoRegion, array); 1338 Util.FireAndForget(HandleCompleteMovementIntoRegion, array);
1520 1339
@@ -1524,12 +1343,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1524 } 1343 }
1525 1344
1526 // Determine which agent this packet came from 1345 // Determine which agent this packet came from
1527<<<<<<< HEAD
1528 IClientAPI client;
1529 if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
1530=======
1531 if (client == null || !(client is LLClientView)) 1346 if (client == null || !(client is LLClientView))
1532>>>>>>> avn/ubitvar
1533 { 1347 {
1534 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 1348 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
1535 1349
@@ -1547,7 +1361,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1547 1361
1548 if (!udpClient.IsConnected) 1362 if (!udpClient.IsConnected)
1549 { 1363 {
1550 m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); 1364 m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + Scene.RegionInfo.RegionName);
1551 return; 1365 return;
1552 } 1366 }
1553 1367
@@ -1652,28 +1466,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1652 LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length); 1466 LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length);
1653 #endregion BinaryStats 1467 #endregion BinaryStats
1654 1468
1655<<<<<<< HEAD
1656 if (packet.Type == PacketType.AgentUpdate)
1657 {
1658 if (DiscardInboundAgentUpdates)
1659 return;
1660
1661 ((LLClientView)client).TotalAgentUpdates++;
1662 1469
1663 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; 1470//Ubit AgentUpdate mess removed from here
1664 1471
1665 LLClientView llClient = client as LLClientView;
1666 if (agentUpdate.AgentData.SessionID != client.SessionId
1667 || agentUpdate.AgentData.AgentID != client.AgentId
1668 || !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) )
1669 {
1670 PacketPool.Instance.ReturnPacket(packet);
1671 return;
1672 }
1673 }
1674=======
1675// AgentUpdate mess removed from here
1676>>>>>>> avn/ubitvar
1677 1472
1678 #region Ping Check Handling 1473 #region Ping Check Handling
1679 1474
@@ -1853,7 +1648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1853 AuthenticateResponse sessionInfo; 1648 AuthenticateResponse sessionInfo;
1854 if (IsClientAuthorized(uccp, out sessionInfo)) 1649 if (IsClientAuthorized(uccp, out sessionInfo))
1855 { 1650 {
1856 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); 1651 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
1857 1652
1858 // Begin the process of adding the client to the simulator 1653 // Begin the process of adding the client to the simulator
1859 client 1654 client
@@ -1868,7 +1663,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1868 // an existing child agent, and there is no circuit data 1663 // an existing child agent, and there is no circuit data
1869 if (client != null && aCircuit == null) 1664 if (client != null && aCircuit == null)
1870 { 1665 {
1871 m_scene.CloseAgent(client.AgentId, true); 1666 Scene.CloseAgent(client.AgentId, true);
1872 return; 1667 return;
1873 } 1668 }
1874 1669
@@ -1908,14 +1703,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1908 // We only want to send initial data to new clients, not ones which are being converted from child to root. 1703 // We only want to send initial data to new clients, not ones which are being converted from child to root.
1909 if (client != null) 1704 if (client != null)
1910 { 1705 {
1911<<<<<<< HEAD
1912 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
1913=======
1914>>>>>>> avn/ubitvar
1915 bool tp = (aCircuit.teleportFlags > 0); 1706 bool tp = (aCircuit.teleportFlags > 0);
1916 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from 1707 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
1917 if (!tp && !client.SceneAgent.SentInitialDataToClient) 1708 if (!tp)
1918 client.SceneAgent.SendInitialDataToClient(); 1709 client.SceneAgent.SendInitialDataToMe();
1919 } 1710 }
1920 } 1711 }
1921 else 1712 else
@@ -1923,17 +1714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1923 // Don't create clients for unauthorized requesters. 1714 // Don't create clients for unauthorized requesters.
1924 m_log.WarnFormat( 1715 m_log.WarnFormat(
1925 "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", 1716 "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}",
1926<<<<<<< HEAD 1717
1927 uccp.CircuitCode.ID, Scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); 1718 uccp.CircuitCode.ID, Scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
1928 }
1929
1930=======
1931 uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
1932 1719
1933 lock (m_pendingCache) 1720 lock (m_pendingCache)
1934 m_pendingCache.Remove(endPoint); 1721 m_pendingCache.Remove(endPoint);
1935 } 1722 }
1936>>>>>>> avn/ubitvar 1723
1937 // m_log.DebugFormat( 1724 // m_log.DebugFormat(
1938 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 1725 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
1939 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 1726 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
@@ -2127,24 +1914,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2127 { 1914 {
2128 if (!Scene.TryGetClient(agentID, out client)) 1915 if (!Scene.TryGetClient(agentID, out client))
2129 { 1916 {
2130<<<<<<< HEAD
2131 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
2132=======
2133 createNew = true; 1917 createNew = true;
2134 } 1918 }
2135 else 1919 else
2136 { 1920 {
2137 if (client.SceneAgent == null) 1921 if (client.SceneAgent == null)
2138 { 1922 {
2139 m_scene.CloseAgent(agentID, true); 1923 Scene.CloseAgent(agentID, true);
2140 createNew = true; 1924 createNew = true;
2141 } 1925 }
2142 } 1926 }
2143 1927
2144 if (createNew) 1928 if (createNew)
2145 { 1929 {
2146 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 1930 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
2147>>>>>>> avn/ubitvar 1931
2148 1932
2149 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 1933 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
2150 client.OnLogout += LogoutHandler; 1934 client.OnLogout += LogoutHandler;
@@ -2174,29 +1958,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2174 { 1958 {
2175 ClientLogoutsDueToNoReceives++; 1959 ClientLogoutsDueToNoReceives++;
2176 1960
2177<<<<<<< HEAD
2178 m_log.WarnFormat(
2179 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
2180 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
2181=======
2182 if (client.SceneAgent != null) 1961 if (client.SceneAgent != null)
2183 { 1962 {
2184 m_log.WarnFormat( 1963 m_log.WarnFormat(
2185 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", 1964 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
2186 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); 1965 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
2187>>>>>>> avn/ubitvar
2188 1966
2189 if (!client.SceneAgent.IsChildAgent) 1967 if (!client.SceneAgent.IsChildAgent)
2190 client.Kick("Simulator logged you out due to connection timeout."); 1968 client.Kick("Simulator logged you out due to connection timeout.");
2191 } 1969 }
2192 } 1970 }
2193 1971
2194<<<<<<< HEAD 1972 if (!Scene.CloseAgent(client.AgentId, true))
2195 Scene.CloseAgent(client.AgentId, true);
2196=======
2197 if (!m_scene.CloseAgent(client.AgentId, true))
2198 client.Close(true,true); 1973 client.Close(true,true);
2199>>>>>>> avn/ubitvar
2200 } 1974 }
2201 1975
2202 private void IncomingPacketHandler() 1976 private void IncomingPacketHandler()
@@ -2209,7 +1983,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2209 1983
2210 while (IsRunningInbound) 1984 while (IsRunningInbound)
2211 { 1985 {
2212 m_scene.ThreadAlive(1); 1986 Scene.ThreadAlive(1);
2213 try 1987 try
2214 { 1988 {
2215 IncomingPacket incomingPacket = null; 1989 IncomingPacket incomingPacket = null;
@@ -2261,7 +2035,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2261 2035
2262 while (base.IsRunningOutbound) 2036 while (base.IsRunningOutbound)
2263 { 2037 {
2264 m_scene.ThreadAlive(2); 2038 Scene.ThreadAlive(2);
2265 try 2039 try
2266 { 2040 {
2267 m_packetSent = false; 2041 m_packetSent = false;
@@ -2524,15 +2298,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2524 { 2298 {
2525 m_currentIncomingClient = null; 2299 m_currentIncomingClient = null;
2526 } 2300 }
2527<<<<<<< HEAD
2528 }
2529 else
2530 {
2531 m_log.DebugFormat(
2532 "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
2533 packet.Type, client.Name, Scene.RegionInfo.RegionName);
2534 }
2535=======
2536// } 2301// }
2537// else 2302// else
2538// { 2303// {
@@ -2540,7 +2305,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2540// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", 2305// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
2541// packet.Type, client.Name, m_scene.RegionInfo.RegionName); 2306// packet.Type, client.Name, m_scene.RegionInfo.RegionName);
2542// } 2307// }
2543>>>>>>> avn/ubitvar
2544 2308
2545 IncomingPacketsProcessed++; 2309 IncomingPacketsProcessed++;
2546 } 2310 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
index ac6c0b4..4ff52eb 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
224 ConsoleDisplayList cdl = new ConsoleDisplayList(); 224 ConsoleDisplayList cdl = new ConsoleDisplayList();
225 cdl.AddRow("Adaptive throttles", m_udpServer.ThrottleRates.AdaptiveThrottlesEnabled); 225 cdl.AddRow("Adaptive throttles", m_udpServer.ThrottleRates.AdaptiveThrottlesEnabled);
226 226
227 long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate; 227 long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;
228 cdl.AddRow( 228 cdl.AddRow(
229 "Max scene throttle", 229 "Max scene throttle",
230 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset"); 230 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
@@ -505,7 +505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
505 m_console.OutputFormat("Debug settings for {0}", m_udpServer.Scene.Name); 505 m_console.OutputFormat("Debug settings for {0}", m_udpServer.Scene.Name);
506 ConsoleDisplayList cdl = new ConsoleDisplayList(); 506 ConsoleDisplayList cdl = new ConsoleDisplayList();
507 507
508 long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate; 508 long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;
509 cdl.AddRow( 509 cdl.AddRow(
510 "max-scene-throttle", 510 "max-scene-throttle",
511 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset"); 511 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
index 3c82a78..5e41dbd 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
@@ -35,6 +35,7 @@ using OpenSim.Tests.Common;
35 35
36namespace OpenSim.Region.ClientStack.LindenUDP.Tests 36namespace OpenSim.Region.ClientStack.LindenUDP.Tests
37{ 37{
38 /*
38 [TestFixture] 39 [TestFixture]
39 public class ThrottleTests : OpenSimTestCase 40 public class ThrottleTests : OpenSimTestCase
40 { 41 {
@@ -57,16 +58,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
57 [Test] 58 [Test]
58 public void TestSetRequestDripRate() 59 public void TestSetRequestDripRate()
59 { 60 {
61
60 TestHelpers.InMethod(); 62 TestHelpers.InMethod();
61 63
62 TokenBucket tb = new TokenBucket("tb", null, 5000, 0); 64 TokenBucket tb = new TokenBucket(null, 5000f,10000f);
63 AssertRates(tb, 5000, 0, 5000, 0); 65 AssertRates(tb, 5000, 0, 5000, 0);
64 66
65 tb.RequestedDripRate = 4000; 67 tb.RequestedDripRate = 4000f;
66 AssertRates(tb, 4000, 0, 4000, 0); 68 AssertRates(tb, 4000, 0, 4000, 0);
67 69
68 tb.RequestedDripRate = 6000; 70 tb.RequestedDripRate = 6000;
69 AssertRates(tb, 6000, 0, 6000, 0); 71 AssertRates(tb, 6000, 0, 6000, 0);
72
70 } 73 }
71 74
72 [Test] 75 [Test]
@@ -74,7 +77,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
74 { 77 {
75 TestHelpers.InMethod(); 78 TestHelpers.InMethod();
76 79
77 TokenBucket tb = new TokenBucket("tb", null, 5000, 10000); 80 TokenBucket tb = new TokenBucket(null, 5000,15000);
78 AssertRates(tb, 5000, 0, 5000, 10000); 81 AssertRates(tb, 5000, 0, 5000, 10000);
79 82
80 tb.RequestedDripRate = 4000; 83 tb.RequestedDripRate = 4000;
@@ -92,9 +95,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
92 { 95 {
93 TestHelpers.InMethod(); 96 TestHelpers.InMethod();
94 97
95 TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0); 98 TokenBucket tbParent = new TokenBucket("tbParent", null, 0);
96 TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0); 99 TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000);
97 TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0); 100 TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000);
98 101
99 AssertRates(tbParent, 8000, 8000, 8000, 0); 102 AssertRates(tbParent, 8000, 8000, 8000, 0);
100 AssertRates(tbChild1, 3000, 0, 3000, 0); 103 AssertRates(tbChild1, 3000, 0, 3000, 0);
@@ -113,6 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
113 AssertRates(tbParent, 6000, 8000, 6000, 0); 116 AssertRates(tbParent, 6000, 8000, 6000, 0);
114 AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0); 117 AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0);
115 AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0); 118 AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0);
119
116 } 120 }
117 121
118 private void AssertRates( 122 private void AssertRates(
@@ -424,4 +428,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
424 udpClient.SetThrottles(throttles); 428 udpClient.SetThrottles(throttles);
425 } 429 }
426 } 430 }
431 */
427} \ No newline at end of file 432} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index 7a42d82..14099fe 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -42,24 +42,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
42 public class TokenBucket 42 public class TokenBucket
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45<<<<<<< HEAD
46 45
47 public string Identifier { get; private set; }
48
49 public int DebugLevel { get; set; }
50
51 /// <summary>
52 /// Number of ticks (ms) per quantum, drip rate and max burst
53 /// are defined over this interval.
54 /// </summary>
55 protected const Int32 m_ticksPerQuantum = 1000;
56=======
57 private static Int32 m_counter = 0; 46 private static Int32 m_counter = 0;
58 47
59// private Int32 m_identifier; 48// private Int32 m_identifier;
60 49
61 protected const float m_timeScale = 1e-3f; 50 protected const float m_timeScale = 1e-3f;
62>>>>>>> avn/ubitvar
63 51
64 /// <summary> 52 /// <summary>
65 /// This is the number of m_minimumDripRate bytes 53 /// This is the number of m_minimumDripRate bytes
@@ -72,11 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
72 60
73 /// <summary> 61 /// <summary>
74 /// </summary> 62 /// </summary>
75<<<<<<< HEAD
76 protected const Int32 m_minimumDripRate = LLUDPServer.MTU;
77=======
78 protected const float m_minimumDripRate = 1400; 63 protected const float m_minimumDripRate = 1400;
79>>>>>>> avn/ubitvar
80 64
81 /// <summary>Time of the last drip, in system ticks</summary> 65 /// <summary>Time of the last drip, in system ticks</summary>
82 protected Int32 m_lastDrip; 66 protected Int32 m_lastDrip;
@@ -90,27 +74,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
90 /// <summary> 74 /// <summary>
91 /// Map of children buckets and their requested maximum burst rate 75 /// Map of children buckets and their requested maximum burst rate
92 /// </summary> 76 /// </summary>
93<<<<<<< HEAD 77
94 protected Dictionary<TokenBucket,Int64> m_children = new Dictionary<TokenBucket,Int64>();
95=======
96 protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>(); 78 protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>();
97 79
98#region Properties 80#region Properties
99>>>>>>> avn/ubitvar
100 81
101 /// <summary> 82 /// <summary>
102 /// The parent bucket of this bucket, or null if this bucket has no 83 /// The parent bucket of this bucket, or null if this bucket has no
103 /// parent. The parent bucket will limit the aggregate bandwidth of all 84 /// parent. The parent bucket will limit the aggregate bandwidth of all
104 /// of its children buckets 85 /// of its children buckets
105 /// </summary> 86 /// </summary>
106 public TokenBucket Parent { get; protected set; } 87 protected TokenBucket m_parent;
107 88 public TokenBucket Parent
89 {
90 get { return m_parent; }
91 set { m_parent = value; }
92 }
108 /// <summary> 93 /// <summary>
109 /// This is the maximum number 94 /// This is the maximum number
110 /// 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
111 /// also sets the total request for leaf nodes 96 /// also sets the total request for leaf nodes
112 /// </summary> 97 /// </summary>
113 protected float m_burst; 98 protected float m_burst;
99//not in use
100 public float MaxDripRate { get; set; }
101
114 public float RequestedBurst 102 public float RequestedBurst
115 { 103 {
116 get { return m_burst; } 104 get { return m_burst; }
@@ -143,63 +131,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
143 /// Can never be above MaxDripRate. 131 /// Can never be above MaxDripRate.
144 /// Tokens are added to the bucket at any time 132 /// Tokens are added to the bucket at any time
145 /// <seealso cref="RemoveTokens"/> is called, at the granularity of 133 /// <seealso cref="RemoveTokens"/> is called, at the granularity of
146<<<<<<< HEAD
147 /// the system tick interval (typically around 15-22ms)
148 /// FIXME: It is extremely confusing to be able to set a RequestedDripRate of 0 and then receive a positive
149 /// number on get if TotalDripRequest is set. This also stops us being able to retrieve the fact that
150 /// RequestedDripRate is set to 0. Really, this should always return m_dripRate and then we can get
151 /// (m_dripRate == 0 ? TotalDripRequest : m_dripRate) on some other properties.
152 /// </remarks>
153 public virtual Int64 RequestedDripRate
154 {
155 get { return (m_dripRate == 0 ? TotalDripRequest : m_dripRate); }
156 set
157 {
158 if (value <= 0)
159 m_dripRate = 0;
160 else if (MaxDripRate > 0 && value > MaxDripRate)
161 m_dripRate = MaxDripRate;
162 else
163 m_dripRate = value;
164
165 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
166
167 if (Parent != null)
168 Parent.RegisterRequest(this, m_dripRate);
169 }
170 }
171
172 /// <summary>
173 /// Gets the drip rate.
174 /// </summary>
175 /// <value>
176 /// DripRate can never be above max drip rate or below min drip rate.
177 /// If we are a child bucket then the drip rate return is modifed by the total load on the capacity of the
178 /// parent bucket.
179 /// </value>
180 public virtual Int64 DripRate
181 {
182 get
183 {
184 double rate;
185
186 // FIXME: This doesn't properly work if we have a parent and children and a requested drip rate set
187 // on ourselves which is not equal to the child drip rates.
188 if (Parent == null)
189 {
190 if (TotalDripRequest > 0)
191 rate = Math.Min(RequestedDripRate, TotalDripRequest);
192 else
193 rate = RequestedDripRate;
194 }
195 else
196 {
197 rate = (double)RequestedDripRate * Parent.DripRateModifier();
198 }
199
200=======
201 /// the system tick interval (typically around 15-22ms)</remarks> 134 /// the system tick interval (typically around 15-22ms)</remarks>
202 protected float m_dripRate; 135 protected float m_dripRate;
136
203 public virtual float RequestedDripRate 137 public virtual float RequestedDripRate
204 { 138 {
205 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } 139 get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); }
@@ -212,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
212 } 146 }
213 } 147 }
214 148
215 public virtual float DripRate 149 public virtual float DripRate
216 { 150 {
217 get { 151 get {
218 float rate = Math.Min(RequestedDripRate,TotalDripRequest); 152 float rate = Math.Min(RequestedDripRate,TotalDripRequest);
@@ -220,28 +154,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
220 return rate; 154 return rate;
221 155
222 rate *= m_parent.DripRateModifier(); 156 rate *= m_parent.DripRateModifier();
223>>>>>>> avn/ubitvar
224 if (rate < m_minimumDripRate) 157 if (rate < m_minimumDripRate)
225 rate = m_minimumDripRate; 158 rate = m_minimumDripRate;
226 else if (MaxDripRate > 0 && rate > MaxDripRate)
227 rate = MaxDripRate;
228 159
229 return (float)rate; 160 return (float)rate;
230 } 161 }
231 } 162 }
232 protected Int64 m_dripRate;
233
234 // <summary>
235 // The maximum rate for flow control. Drip rate can never be greater than this.
236 // </summary>
237 public Int64 MaxDripRate { get; set; }
238 163
239 /// <summary> 164 /// <summary>
240 /// The current total of the requested maximum burst rates of children buckets. 165 /// The current total of the requested maximum burst rates of children buckets.
241 /// </summary> 166 /// </summary>
242<<<<<<< HEAD
243 public Int64 TotalDripRequest { get; protected set; }
244=======
245 protected float m_totalDripRequest; 167 protected float m_totalDripRequest;
246 public float TotalDripRequest 168 public float TotalDripRequest
247 { 169 {
@@ -252,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
252#endregion Properties 174#endregion Properties
253 175
254#region Constructor 176#region Constructor
255>>>>>>> avn/ubitvar 177
256 178
257 /// <summary> 179 /// <summary>
258 /// Default constructor 180 /// Default constructor
@@ -260,36 +182,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
260 /// <param name="identifier">Identifier for this token bucket</param> 182 /// <param name="identifier">Identifier for this token bucket</param>
261 /// <param name="parent">Parent bucket if this is a child bucket, or 183 /// <param name="parent">Parent bucket if this is a child bucket, or
262 /// null if this is a root bucket</param> 184 /// null if this is a root bucket</param>
263<<<<<<< HEAD
264 /// <param name="requestedDripRate">
265 /// Requested rate that the bucket fills, in bytes per
266 /// second. If zero, the bucket always remains full.
267 /// </param>
268 public TokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate)
269=======
270 /// <param name="maxBurst">Maximum size of the bucket in bytes, or 185 /// <param name="maxBurst">Maximum size of the bucket in bytes, or
271 /// zero if this bucket has no maximum capacity</param> 186 /// zero if this bucket has no maximum capacity</param>
272 /// <param name="dripRate">Rate that the bucket fills, in bytes per 187 /// <param name="dripRate">Rate that the bucket fills, in bytes per
273 /// second. If zero, the bucket always remains full</param> 188 /// second. If zero, the bucket always remains full</param>
274 public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst) 189 public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst)
275>>>>>>> avn/ubitvar
276 { 190 {
277 Identifier = identifier; 191 m_counter++;
278 192
279 Parent = parent; 193 Parent = parent;
280<<<<<<< HEAD
281 RequestedDripRate = requestedDripRate;
282 MaxDripRate = maxDripRate;
283 m_lastDrip = Util.EnvironmentTickCount();
284=======
285 RequestedDripRate = dripRate; 194 RequestedDripRate = dripRate;
286 RequestedBurst = MaxBurst; 195 RequestedBurst = MaxBurst;
287 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers 196 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers
288 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); 197 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
289 m_lastDrip = Util.EnvironmentTickCount() + 100000; 198 m_lastDrip = Util.EnvironmentTickCount() + 100000;
290>>>>>>> avn/ubitvar
291 } 199 }
292 200
201#endregion Constructor
202
293 /// <summary> 203 /// <summary>
294 /// Compute a modifier for the MaxBurst rate. This is 1.0, meaning 204 /// Compute a modifier for the MaxBurst rate. This is 1.0, meaning
295 /// no modification if the requested bandwidth is less than the 205 /// no modification if the requested bandwidth is less than the
@@ -299,20 +209,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
299 /// </summary> 209 /// </summary>
300 protected float DripRateModifier() 210 protected float DripRateModifier()
301 { 211 {
302<<<<<<< HEAD
303 Int64 driprate = DripRate;
304 double modifier = driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest;
305
306// if (DebugLevel > 0)
307// m_log.DebugFormat(
308// "[TOKEN BUCKET]: Returning drip modifier {0}/{1} = {2} from {3}",
309// driprate, TotalDripRequest, modifier, Identifier);
310
311 return modifier;
312=======
313 float driprate = DripRate; 212 float driprate = DripRate;
314 return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; 213 return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest;
315>>>>>>> avn/ubitvar
316 } 214 }
317 215
318 /// <summary> 216 /// <summary>
@@ -335,29 +233,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
335 { 233 {
336 m_children[child] = request; 234 m_children[child] = request;
337 235
338<<<<<<< HEAD
339 TotalDripRequest = 0;
340 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
341 TotalDripRequest += cref.Value;
342=======
343 m_totalDripRequest = 0; 236 m_totalDripRequest = 0;
344 foreach (KeyValuePair<TokenBucket, float> cref in m_children) 237 foreach (KeyValuePair<TokenBucket, float> cref in m_children)
345 m_totalDripRequest += cref.Value; 238 m_totalDripRequest += cref.Value;
346>>>>>>> avn/ubitvar
347 } 239 }
348 240
349 // Pass the new values up to the parent 241 // Pass the new values up to the parent
350 if (Parent != null) 242 if (m_parent != null)
351 { 243 m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
352 Int64 effectiveDripRate;
353
354 if (RequestedDripRate > 0)
355 effectiveDripRate = Math.Min(RequestedDripRate, TotalDripRequest);
356 else
357 effectiveDripRate = TotalDripRequest;
358
359 Parent.RegisterRequest(this, effectiveDripRate);
360 }
361 } 244 }
362 245
363 /// <summary> 246 /// <summary>
@@ -370,15 +253,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
370 { 253 {
371 m_children.Remove(child); 254 m_children.Remove(child);
372 255
373<<<<<<< HEAD
374 TotalDripRequest = 0;
375 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
376 TotalDripRequest += cref.Value;
377=======
378 m_totalDripRequest = 0; 256 m_totalDripRequest = 0;
379 foreach (KeyValuePair<TokenBucket, float> cref in m_children) 257 foreach (KeyValuePair<TokenBucket, float> cref in m_children)
380 m_totalDripRequest += cref.Value; 258 m_totalDripRequest += cref.Value;
381>>>>>>> avn/ubitvar
382 } 259 }
383 260
384 // Pass the new values up to the parent 261 // Pass the new values up to the parent
@@ -427,7 +304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
427 // with no drip rate... 304 // with no drip rate...
428 if (DripRate == 0) 305 if (DripRate == 0)
429 { 306 {
430 m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", Identifier); 307 m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", m_counter);
431 return; 308 return;
432 } 309 }
433 310
@@ -453,17 +330,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
453 public bool AdaptiveEnabled { get; set; } 330 public bool AdaptiveEnabled { get; set; }
454 331
455 /// <summary> 332 /// <summary>
456<<<<<<< HEAD
457 /// Target drip rate for this bucket.
458 /// </summary>
459 /// <remarks>Usually set by the client. If adaptive is enabled then throttles will increase until we reach this.</remarks>
460 public Int64 TargetDripRate
461 {
462 get { return m_targetDripRate; }
463 set
464 {
465 m_targetDripRate = Math.Max(value, m_minimumFlow);
466=======
467 /// The minimum rate for flow control. Minimum drip rate is one 333 /// The minimum rate for flow control. Minimum drip rate is one
468 /// packet per second. 334 /// packet per second.
469 /// </summary> 335 /// </summary>
@@ -479,13 +345,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
479 public float MaxDripRate 345 public float MaxDripRate
480 { 346 {
481 get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } 347 get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); }
482 set 348 set
483 { 349 {
484 m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow)); 350 m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow));
485>>>>>>> avn/ubitvar
486 } 351 }
487 } 352 }
488 protected Int64 m_targetDripRate; 353
354 private bool m_enabled = false;
489 355
490 // <summary> 356 // <summary>
491 // Adjust drip rate in response to network conditions. 357 // Adjust drip rate in response to network conditions.
@@ -493,109 +359,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP
493 public virtual float AdjustedDripRate 359 public virtual float AdjustedDripRate
494 { 360 {
495 get { return m_dripRate; } 361 get { return m_dripRate; }
496<<<<<<< HEAD 362 set
497 set
498 { 363 {
499 m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value, m_minimumFlow, TargetDripRate); 364 m_dripRate = OpenSim.Framework.Util.Clamp<float>(value, m_minimumFlow, MaxDripRate);
500 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
501
502 if (Parent != null)
503 Parent.RegisterRequest(this, m_dripRate);
504=======
505 set {
506 m_dripRate = OpenSim.Framework.Util.Clamp<float>(value,m_minimumFlow,MaxDripRate);
507 365
508 if (m_parent != null) 366 if (m_parent != null)
509 m_parent.RegisterRequest(this,m_dripRate); 367 m_parent.RegisterRequest(this, m_dripRate);
510>>>>>>> avn/ubitvar
511 } 368 }
512 } 369 }
513 370
514 /// <summary> 371
515 /// The minimum rate for adaptive flow control.
516 /// </summary>
517 protected Int64 m_minimumFlow = 32000;
518
519<<<<<<< HEAD
520 /// <summary>
521 /// Constructor for the AdaptiveTokenBucket class
522 /// <param name="identifier">Unique identifier for the client</param>
523 /// <param name="parent">Parent bucket in the hierarchy</param>
524 /// <param name="requestedDripRate"></param>
525 /// <param name="maxDripRate">The ceiling rate for adaptation</param>
526 /// <param name="minDripRate">The floor rate for adaptation</param>
527 /// </summary>
528 public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, Int64 minDripRate, bool enabled)
529 : base(identifier, parent, requestedDripRate, maxDripRate)
530 {
531 AdaptiveEnabled = enabled;
532
533 if (AdaptiveEnabled)
534 {
535// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled");
536 m_minimumFlow = minDripRate;
537 TargetDripRate = m_minimumFlow;
538 AdjustedDripRate = m_minimumFlow;
539 }
540=======
541 // <summary> 372 // <summary>
542 // 373 //
543 // </summary> 374 // </summary>
544 public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate,float maxBurst, bool enabled) 375 public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate, float maxBurst, bool enabled)
545 : base(parent, maxDripRate,maxBurst) 376 : base(parent, maxDripRate, maxBurst)
546 { 377 {
547 m_enabled = enabled; 378 m_enabled = enabled;
548 379
549 MaxDripRate = maxDripRate; 380 MaxDripRate = maxDripRate;
550 381
551 if (enabled) 382 if (enabled)
552 AdjustedDripRate = m_maxDripRate * .5f; 383 AdjustedDripRate = m_maxDripRate * .5f;
553 else 384 else
554 AdjustedDripRate = m_maxDripRate; 385 AdjustedDripRate = m_maxDripRate;
555>>>>>>> avn/ubitvar
556 } 386 }
557 387
558 /// <summary> 388 /// <summary>
559 /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down. 389 /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
560 /// <param name="packets">Number of packets that expired without successful delivery</param> 390 /// <param name="packets">Number of packets that expired without successful delivery</param>
561 /// </summary> 391 /// </summary>
562 public void ExpirePackets(Int32 packets) 392 public void ExpirePackets(Int32 count)
563 {
564 if (AdaptiveEnabled)
565 {
566 if (DebugLevel > 0)
567 m_log.WarnFormat(
568 "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}",
569 AdjustedDripRate, packets, Identifier);
570
571 // AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets));
572
573 // Compute the fallback solely on the rate allocated beyond the minimum, this
574 // should smooth out the fallback to the minimum rate
575 AdjustedDripRate = m_minimumFlow + (Int64) ((AdjustedDripRate - m_minimumFlow) / Math.Pow(2, packets));
576 }
577 }
578
579 /// <summary>
580 /// Reliable packets acked by the client adjust the drip rate up.
581 /// <param name="packets">Number of packets successfully acknowledged</param>
582 /// </summary>
583 public void AcknowledgePackets(Int32 packets)
584 { 393 {
585 if (AdaptiveEnabled) 394 // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count);
586 AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU; 395 if (m_enabled)
396 AdjustedDripRate = (Int64)(AdjustedDripRate / Math.Pow(2, count));
587 } 397 }
588 398
589 /// <summary> 399 // <summary>
590 /// Adjust the minimum flow level for the adaptive throttle, this will drop adjusted 400 //
591 /// throttles back to the minimum levels 401 // </summary>
592 /// <param>minDripRate--the new minimum flow</param> 402 public void AcknowledgePackets(Int32 count)
593 /// </summary>
594 public void ResetMinimumAdaptiveFlow(Int64 minDripRate)
595 { 403 {
596 m_minimumFlow = minDripRate; 404 if (m_enabled)
597 TargetDripRate = m_minimumFlow; 405 AdjustedDripRate = AdjustedDripRate + count;
598 AdjustedDripRate = m_minimumFlow;
599 } 406 }
600 } 407 }
601} 408}