aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs284
1 files changed, 117 insertions, 167 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 31cd53f..767020f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -70,28 +70,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
70 private readonly LLUDPServer m_udpServer; 70 private readonly LLUDPServer m_udpServer;
71 private readonly LLUDPClient m_udpClient; 71 private readonly LLUDPClient m_udpClient;
72 private readonly UUID m_sessionId; 72 private readonly UUID m_sessionId;
73 private readonly UUID m_secureSessionId = UUID.Zero; 73 private readonly UUID m_secureSessionId;
74 private readonly UUID m_agentId; 74 private readonly UUID m_agentId;
75 private readonly uint m_circuitCode; 75 private readonly uint m_circuitCode;
76 private readonly byte[] m_channelVersion = Utils.StringToBytes("OpenSimulator Server"); // Dummy value needed by libSL 76 private readonly byte[] m_channelVersion = Utils.EmptyBytes;
77 private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>(); 77 private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
78 private readonly IGroupsModule m_GroupsModule; 78 private readonly IGroupsModule m_GroupsModule;
79 79
80 private int m_debugPacketLevel;
81 private int m_cachedTextureSerial; 80 private int m_cachedTextureSerial;
82 private Timer m_clientPingTimer;
83 private Timer m_avatarTerseUpdateTimer; 81 private Timer m_avatarTerseUpdateTimer;
84 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 82 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
85 private Timer m_primTerseUpdateTimer; 83 private Timer m_primTerseUpdateTimer;
86 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(); 84 private List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates = new List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
87 private Timer m_primFullUpdateTimer; 85 private Timer m_primFullUpdateTimer;
88 private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = new List<ObjectUpdatePacket.ObjectDataBlock>(); 86 private List<ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates = new List<ObjectUpdatePacket.ObjectDataBlock>();
89 private bool m_clientBlocked;
90 private int m_probesWithNoIngressPackets;
91 private int m_moneyBalance; 87 private int m_moneyBalance;
92 private int m_animationSequenceNumber = 1; 88 private int m_animationSequenceNumber = 1;
93 private bool m_SendLogoutPacketWhenClosing = true; 89 private bool m_SendLogoutPacketWhenClosing = true;
94 private int m_inPacketsChecked;
95 private AgentUpdateArgs lastarg; 90 private AgentUpdateArgs lastarg;
96 private bool m_IsActive = true; 91 private bool m_IsActive = true;
97 92
@@ -170,58 +165,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP
170 RegisterInterface<IClientIM>(this); 165 RegisterInterface<IClientIM>(this);
171 RegisterInterface<IClientChat>(this); 166 RegisterInterface<IClientChat>(this);
172 RegisterInterface<IClientIPEndpoint>(this); 167 RegisterInterface<IClientIPEndpoint>(this);
173 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 168
174
175 m_moneyBalance = 1000;
176
177 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion());
178
179 InitDefaultAnimations(); 169 InitDefaultAnimations();
180 170
181 m_scene = scene; 171 m_scene = scene;
182 //m_assetCache = assetCache;
183
184 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 172 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
185 173 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
186 m_udpServer = udpServer; 174 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
187 m_udpClient = udpClient; 175 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion());
188
189 m_agentId = agentId; 176 m_agentId = agentId;
190 m_sessionId = sessionId; 177 m_sessionId = sessionId;
178 m_secureSessionId = sessionInfo.LoginInfo.SecureSession;
191 m_circuitCode = circuitCode; 179 m_circuitCode = circuitCode;
192
193 m_userEndPoint = remoteEP; 180 m_userEndPoint = remoteEP;
194
195 m_firstName = sessionInfo.LoginInfo.First; 181 m_firstName = sessionInfo.LoginInfo.First;
196 m_lastName = sessionInfo.LoginInfo.Last; 182 m_lastName = sessionInfo.LoginInfo.Last;
197 m_startpos = sessionInfo.LoginInfo.StartPos; 183 m_startpos = sessionInfo.LoginInfo.StartPos;
184 m_moneyBalance = 1000;
198 185
199 if (sessionInfo.LoginInfo.SecureSession != UUID.Zero) 186 m_udpServer = udpServer;
200 { 187 m_udpClient = udpClient;
201 m_secureSessionId = sessionInfo.LoginInfo.SecureSession; 188 m_udpClient.OnQueueEmpty += HandleQueueEmpty;
202 } 189 // FIXME: Implement this
203 190 //m_udpClient.OnPacketStats += PopulateStats;
204 // While working on this, the BlockingQueue had me fooled for a bit.
205 // The Blocking queue causes the thread to stop until there's something
206 // in it to process. It's an on-purpose threadlock though because
207 // without it, the clientloop will suck up all sim resources.
208
209 //m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings);
210 //m_PacketHandler.SynchronizeClient = SynchronizeClient;
211 //m_PacketHandler.OnPacketStats += PopulateStats;
212 //m_PacketHandler.OnQueueEmpty += HandleQueueEmpty;
213 191
214 RegisterLocalPacketHandlers(); 192 RegisterLocalPacketHandlers();
215 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
216 } 193 }
217 194
218 public void SetDebugPacketLevel(int newDebugPacketLevel) 195 public void SetDebugPacketLevel(int newDebug)
219 { 196 {
220 m_debugPacketLevel = newDebugPacketLevel;
221 } 197 }
222 198
223 #region Client Methods 199 #region Client Methods
224 200
201 /// <summary>
202 /// Close down the client view. This *must* be the last method called, since the last #
203 /// statement of CloseCleanup() aborts the thread.
204 /// </summary>
205 /// <param name="shutdownCircuit"></param>
206 public void Close(bool shutdownCircuit)
207 {
208 m_log.DebugFormat(
209 "[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}",
210 shutdownCircuit, Name, m_scene.RegionInfo.RegionName);
211
212 if (m_imageManager != null)
213 m_imageManager.Close();
214
215 if (m_udpServer != null)
216 m_udpServer.Flush();
217
218 // raise an event on the packet server to Shutdown the circuit
219 // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup
220 // here otherwise we'll end up calling it twice.
221 // FIXME: In truth, I might be wrong but this whole business of calling this method twice (with different args) looks
222 // horribly tangly. Hopefully it should be possible to greatly simplify it.
223 if (shutdownCircuit)
224 {
225 if (OnConnectionClosed != null)
226 OnConnectionClosed(this);
227 }
228 else
229 {
230 CloseCleanup(shutdownCircuit);
231 }
232 }
233
225 private void CloseCleanup(bool shutdownCircuit) 234 private void CloseCleanup(bool shutdownCircuit)
226 { 235 {
227 m_scene.RemoveClient(AgentId); 236 m_scene.RemoveClient(AgentId);
@@ -236,9 +245,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
236 Thread.Sleep(2000); 245 Thread.Sleep(2000);
237 246
238 // Shut down timers. Thread Context of this method is murky. Lock all timers 247 // Shut down timers. Thread Context of this method is murky. Lock all timers
239 if (m_clientPingTimer.Enabled)
240 lock (m_clientPingTimer)
241 m_clientPingTimer.Stop();
242 if (m_avatarTerseUpdateTimer.Enabled) 248 if (m_avatarTerseUpdateTimer.Enabled)
243 lock (m_avatarTerseUpdateTimer) 249 lock (m_avatarTerseUpdateTimer)
244 m_avatarTerseUpdateTimer.Stop(); 250 m_avatarTerseUpdateTimer.Stop();
@@ -271,43 +277,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
271 // of the client thread regardless of where Close() is called. 277 // of the client thread regardless of where Close() is called.
272 KillEndDone(); 278 KillEndDone();
273 } 279 }
274
275 Terminate();
276 }
277 280
278 /// <summary> 281 IsActive = false;
279 /// Close down the client view. This *must* be the last method called, since the last #
280 /// statement of CloseCleanup() aborts the thread.
281 /// </summary>
282 /// <param name="shutdownCircuit"></param>
283 public void Close(bool shutdownCircuit)
284 {
285 m_clientPingTimer.Enabled = false;
286 282
287 m_log.DebugFormat( 283 m_avatarTerseUpdateTimer.Close();
288 "[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}", 284 m_primTerseUpdateTimer.Close();
289 shutdownCircuit, Name, m_scene.RegionInfo.RegionName); 285 m_primFullUpdateTimer.Close();
290 286
291 if (m_imageManager != null) 287 //m_udpServer.OnPacketStats -= PopulateStats;
292 m_imageManager.Close(); 288 m_udpClient.Shutdown();
293 289
294 if (m_udpServer != null) 290 // wait for thread stoped
295 m_udpServer.Flush(); 291 // m_clientThread.Join();
296 292
297 // raise an event on the packet server to Shutdown the circuit 293 // delete circuit code
298 // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup 294 //m_networkServer.CloseClient(this);
299 // here otherwise we'll end up calling it twice.
300 // FIXME: In truth, I might be wrong but this whole business of calling this method twice (with different args) looks
301 // horribly tangly. Hopefully it should be possible to greatly simplify it.
302 if (shutdownCircuit)
303 {
304 if (OnConnectionClosed != null)
305 OnConnectionClosed(this);
306 }
307 else
308 {
309 CloseCleanup(shutdownCircuit);
310 }
311 } 295 }
312 296
313 public void Kick(string message) 297 public void Kick(string message)
@@ -329,10 +313,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
329 public void Stop() 313 public void Stop()
330 { 314 {
331 // Shut down timers. Thread Context is Murky, lock all timers! 315 // Shut down timers. Thread Context is Murky, lock all timers!
332 if (m_clientPingTimer.Enabled)
333 lock (m_clientPingTimer)
334 m_clientPingTimer.Stop();
335
336 if (m_avatarTerseUpdateTimer.Enabled) 316 if (m_avatarTerseUpdateTimer.Enabled)
337 lock (m_avatarTerseUpdateTimer) 317 lock (m_avatarTerseUpdateTimer)
338 m_avatarTerseUpdateTimer.Stop(); 318 m_avatarTerseUpdateTimer.Stop();
@@ -346,25 +326,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
346 m_primFullUpdateTimer.Stop(); 326 m_primFullUpdateTimer.Stop();
347 } 327 }
348 328
349 private void Terminate()
350 {
351 IsActive = false;
352
353 m_clientPingTimer.Close();
354 m_avatarTerseUpdateTimer.Close();
355 m_primTerseUpdateTimer.Close();
356 m_primFullUpdateTimer.Close();
357
358 //m_udpServer.OnPacketStats -= PopulateStats;
359 m_udpClient.Shutdown();
360
361 // wait for thread stoped
362 // m_clientThread.Join();
363
364 // delete circuit code
365 //m_networkServer.CloseClient(this);
366 }
367
368 #endregion Client Methods 329 #endregion Client Methods
369 330
370 #region Packet Handling 331 #region Packet Handling
@@ -452,7 +413,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
452 return result; 413 return result;
453 } 414 }
454 415
455 protected void DebugPacket(string direction, Packet packet) 416 /*protected void DebugPacket(string direction, Packet packet)
456 { 417 {
457 string info; 418 string info;
458 419
@@ -478,7 +439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
478 } 439 }
479 440
480 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); 441 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
481 } 442 }*/
482 443
483 #endregion Packet Handling 444 #endregion Packet Handling
484 445
@@ -490,8 +451,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
490 /// </summary> 451 /// </summary>
491 protected virtual void InitNewClient() 452 protected virtual void InitNewClient()
492 { 453 {
493 //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
494
495 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); 454 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate);
496 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); 455 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates);
497 m_avatarTerseUpdateTimer.AutoReset = false; 456 m_avatarTerseUpdateTimer.AutoReset = false;
@@ -511,11 +470,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
511 470
512 public virtual void Start() 471 public virtual void Start()
513 { 472 {
514 m_clientThread = new Thread(RunUserSession); 473 // This sets up all the timers
515 m_clientThread.Name = "ClientThread"; 474 InitNewClient();
516 m_clientThread.IsBackground = true;
517 m_clientThread.Start();
518 ThreadTracker.Add(m_clientThread);
519 } 475 }
520 476
521 /// <summary> 477 /// <summary>
@@ -523,14 +479,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
523 /// </summary> 479 /// </summary>
524 protected void RunUserSession() 480 protected void RunUserSession()
525 { 481 {
526 //tell this thread we are using the culture set up for the sim (currently hardcoded to en_US)
527 //otherwise it will override this and use the system default
528 Culture.SetCurrentCulture();
529
530 try 482 try
531 { 483 {
532 // This sets up all the timers 484
533 InitNewClient();
534 } 485 }
535 catch (Exception e) 486 catch (Exception e)
536 { 487 {
@@ -1373,8 +1324,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1373 public void SendStartPingCheck(byte seq) 1324 public void SendStartPingCheck(byte seq)
1374 { 1325 {
1375 StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); 1326 StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
1376 pc.PingID.PingID = seq;
1377 pc.Header.Reliable = false; 1327 pc.Header.Reliable = false;
1328
1329 OutgoingPacket oldestPacket = m_udpClient.NeedAcks.GetOldest();
1330
1331 pc.PingID.PingID = seq;
1332 pc.PingID.OldestUnacked = (oldestPacket != null) ? oldestPacket.SequenceNumber : 0;
1333
1378 OutPacket(pc, ThrottleOutPacketType.Unknown); 1334 OutPacket(pc, ThrottleOutPacketType.Unknown);
1379 } 1335 }
1380 1336
@@ -1450,12 +1406,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1450 descend.ItemData[i].AssetID = item.AssetID; 1406 descend.ItemData[i].AssetID = item.AssetID;
1451 descend.ItemData[i].CreatorID = item.CreatorIdAsUuid; 1407 descend.ItemData[i].CreatorID = item.CreatorIdAsUuid;
1452 descend.ItemData[i].BaseMask = item.BasePermissions; 1408 descend.ItemData[i].BaseMask = item.BasePermissions;
1453 descend.ItemData[i].Description = LLUtil.StringToPacketBytes(item.Description); 1409 descend.ItemData[i].Description = Util.StringToBytes256(item.Description);
1454 descend.ItemData[i].EveryoneMask = item.EveryOnePermissions; 1410 descend.ItemData[i].EveryoneMask = item.EveryOnePermissions;
1455 descend.ItemData[i].OwnerMask = item.CurrentPermissions; 1411 descend.ItemData[i].OwnerMask = item.CurrentPermissions;
1456 descend.ItemData[i].FolderID = item.Folder; 1412 descend.ItemData[i].FolderID = item.Folder;
1457 descend.ItemData[i].InvType = (sbyte)item.InvType; 1413 descend.ItemData[i].InvType = (sbyte)item.InvType;
1458 descend.ItemData[i].Name = LLUtil.StringToPacketBytes(item.Name); 1414 descend.ItemData[i].Name = Util.StringToBytes256(item.Name);
1459 descend.ItemData[i].NextOwnerMask = item.NextPermissions; 1415 descend.ItemData[i].NextOwnerMask = item.NextPermissions;
1460 descend.ItemData[i].OwnerID = item.Owner; 1416 descend.ItemData[i].OwnerID = item.Owner;
1461 descend.ItemData[i].Type = (sbyte)item.AssetType; 1417 descend.ItemData[i].Type = (sbyte)item.AssetType;
@@ -1536,7 +1492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1536 { 1492 {
1537 descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); 1493 descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
1538 descend.FolderData[i].FolderID = folder.ID; 1494 descend.FolderData[i].FolderID = folder.ID;
1539 descend.FolderData[i].Name = LLUtil.StringToPacketBytes(folder.Name); 1495 descend.FolderData[i].Name = Util.StringToBytes256(folder.Name);
1540 descend.FolderData[i].ParentID = folder.ParentID; 1496 descend.FolderData[i].ParentID = folder.ParentID;
1541 descend.FolderData[i].Type = (sbyte)folder.Type; 1497 descend.FolderData[i].Type = (sbyte)folder.Type;
1542 1498
@@ -1651,11 +1607,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1651 inventoryReply.InventoryData[0].BaseMask = item.BasePermissions; 1607 inventoryReply.InventoryData[0].BaseMask = item.BasePermissions;
1652 inventoryReply.InventoryData[0].CreationDate = item.CreationDate; 1608 inventoryReply.InventoryData[0].CreationDate = item.CreationDate;
1653 1609
1654 inventoryReply.InventoryData[0].Description = LLUtil.StringToPacketBytes(item.Description); 1610 inventoryReply.InventoryData[0].Description = Util.StringToBytes256(item.Description);
1655 inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions; 1611 inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions;
1656 inventoryReply.InventoryData[0].FolderID = item.Folder; 1612 inventoryReply.InventoryData[0].FolderID = item.Folder;
1657 inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType; 1613 inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType;
1658 inventoryReply.InventoryData[0].Name = LLUtil.StringToPacketBytes(item.Name); 1614 inventoryReply.InventoryData[0].Name = Util.StringToBytes256(item.Name);
1659 inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions; 1615 inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions;
1660 inventoryReply.InventoryData[0].OwnerID = item.Owner; 1616 inventoryReply.InventoryData[0].OwnerID = item.Owner;
1661 inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions; 1617 inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions;
@@ -1780,7 +1736,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1780 folderBlock.FolderID = folder.ID; 1736 folderBlock.FolderID = folder.ID;
1781 folderBlock.ParentID = folder.ParentID; 1737 folderBlock.ParentID = folder.ParentID;
1782 folderBlock.Type = -1; 1738 folderBlock.Type = -1;
1783 folderBlock.Name = LLUtil.StringToPacketBytes(folder.Name); 1739 folderBlock.Name = Util.StringToBytes256(folder.Name);
1784 1740
1785 return folderBlock; 1741 return folderBlock;
1786 } 1742 }
@@ -1798,11 +1754,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1798 itemBlock.AssetID = item.AssetID; 1754 itemBlock.AssetID = item.AssetID;
1799 itemBlock.CreatorID = item.CreatorIdAsUuid; 1755 itemBlock.CreatorID = item.CreatorIdAsUuid;
1800 itemBlock.BaseMask = item.BasePermissions; 1756 itemBlock.BaseMask = item.BasePermissions;
1801 itemBlock.Description = LLUtil.StringToPacketBytes(item.Description); 1757 itemBlock.Description = Util.StringToBytes256(item.Description);
1802 itemBlock.EveryoneMask = item.EveryOnePermissions; 1758 itemBlock.EveryoneMask = item.EveryOnePermissions;
1803 itemBlock.FolderID = item.Folder; 1759 itemBlock.FolderID = item.Folder;
1804 itemBlock.InvType = (sbyte)item.InvType; 1760 itemBlock.InvType = (sbyte)item.InvType;
1805 itemBlock.Name = LLUtil.StringToPacketBytes(item.Name); 1761 itemBlock.Name = Util.StringToBytes256(item.Name);
1806 itemBlock.NextOwnerMask = item.NextPermissions; 1762 itemBlock.NextOwnerMask = item.NextPermissions;
1807 itemBlock.OwnerID = item.Owner; 1763 itemBlock.OwnerID = item.Owner;
1808 itemBlock.OwnerMask = item.CurrentPermissions; 1764 itemBlock.OwnerMask = item.CurrentPermissions;
@@ -1862,11 +1818,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1862 bulkUpdate.ItemData[0].CreatorID = item.CreatorIdAsUuid; 1818 bulkUpdate.ItemData[0].CreatorID = item.CreatorIdAsUuid;
1863 bulkUpdate.ItemData[0].BaseMask = item.BasePermissions; 1819 bulkUpdate.ItemData[0].BaseMask = item.BasePermissions;
1864 bulkUpdate.ItemData[0].CreationDate = item.CreationDate; 1820 bulkUpdate.ItemData[0].CreationDate = item.CreationDate;
1865 bulkUpdate.ItemData[0].Description = LLUtil.StringToPacketBytes(item.Description); 1821 bulkUpdate.ItemData[0].Description = Util.StringToBytes256(item.Description);
1866 bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions; 1822 bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions;
1867 bulkUpdate.ItemData[0].FolderID = item.Folder; 1823 bulkUpdate.ItemData[0].FolderID = item.Folder;
1868 bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType; 1824 bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType;
1869 bulkUpdate.ItemData[0].Name = LLUtil.StringToPacketBytes(item.Name); 1825 bulkUpdate.ItemData[0].Name = Util.StringToBytes256(item.Name);
1870 bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions; 1826 bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions;
1871 bulkUpdate.ItemData[0].OwnerID = item.Owner; 1827 bulkUpdate.ItemData[0].OwnerID = item.Owner;
1872 bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions; 1828 bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions;
@@ -1909,11 +1865,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1909 InventoryReply.InventoryData[0].AssetID = Item.AssetID; 1865 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
1910 InventoryReply.InventoryData[0].CreatorID = Item.CreatorIdAsUuid; 1866 InventoryReply.InventoryData[0].CreatorID = Item.CreatorIdAsUuid;
1911 InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions; 1867 InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions;
1912 InventoryReply.InventoryData[0].Description = LLUtil.StringToPacketBytes(Item.Description); 1868 InventoryReply.InventoryData[0].Description = Util.StringToBytes256(Item.Description);
1913 InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions; 1869 InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions;
1914 InventoryReply.InventoryData[0].FolderID = Item.Folder; 1870 InventoryReply.InventoryData[0].FolderID = Item.Folder;
1915 InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType; 1871 InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType;
1916 InventoryReply.InventoryData[0].Name = LLUtil.StringToPacketBytes(Item.Name); 1872 InventoryReply.InventoryData[0].Name = Util.StringToBytes256(Item.Name);
1917 InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions; 1873 InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions;
1918 InventoryReply.InventoryData[0].OwnerID = Item.Owner; 1874 InventoryReply.InventoryData[0].OwnerID = Item.Owner;
1919 InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions; 1875 InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions;
@@ -2080,7 +2036,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2080 /// <param name="message"></param> 2036 /// <param name="message"></param>
2081 /// <param name="modal"></param> 2037 /// <param name="modal"></param>
2082 /// <returns></returns> 2038 /// <returns></returns>
2083 protected AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal) 2039 public AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal)
2084 { 2040 {
2085 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); 2041 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
2086 alertPack.AgentData.AgentID = AgentId; 2042 alertPack.AgentData.AgentID = AgentId;
@@ -3533,7 +3489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3533 objectData.FullID = objectID; 3489 objectData.FullID = objectID;
3534 objectData.OwnerID = ownerID; 3490 objectData.OwnerID = ownerID;
3535 3491
3536 objectData.Text = LLUtil.StringToPacketBytes(text); 3492 objectData.Text = Util.StringToBytes256(text);
3537 objectData.TextColor[0] = color[0]; 3493 objectData.TextColor[0] = color[0];
3538 objectData.TextColor[1] = color[1]; 3494 objectData.TextColor[1] = color[1];
3539 objectData.TextColor[2] = color[2]; 3495 objectData.TextColor[2] = color[2];
@@ -3911,8 +3867,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3911 objPropDB.SalePrice = SalePrice; 3867 objPropDB.SalePrice = SalePrice;
3912 objPropDB.Category = Category; 3868 objPropDB.Category = Category;
3913 objPropDB.LastOwnerID = LastOwnerID; 3869 objPropDB.LastOwnerID = LastOwnerID;
3914 objPropDB.Name = LLUtil.StringToPacketBytes(ObjectName); 3870 objPropDB.Name = Util.StringToBytes256(ObjectName);
3915 objPropDB.Description = LLUtil.StringToPacketBytes(Description); 3871 objPropDB.Description = Util.StringToBytes256(Description);
3916 objPropFamilyPack.ObjectData = objPropDB; 3872 objPropFamilyPack.ObjectData = objPropDB;
3917 objPropFamilyPack.Header.Zerocoded = true; 3873 objPropFamilyPack.Header.Zerocoded = true;
3918 OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task); 3874 OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task);
@@ -3946,11 +3902,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3946 proper.ObjectData[0].OwnerID = UUID.Zero; 3902 proper.ObjectData[0].OwnerID = UUID.Zero;
3947 else 3903 else
3948 proper.ObjectData[0].OwnerID = OwnerUUID; 3904 proper.ObjectData[0].OwnerID = OwnerUUID;
3949 proper.ObjectData[0].TouchName = LLUtil.StringToPacketBytes(TouchTitle); 3905 proper.ObjectData[0].TouchName = Util.StringToBytes256(TouchTitle);
3950 proper.ObjectData[0].TextureID = TextureID; 3906 proper.ObjectData[0].TextureID = TextureID;
3951 proper.ObjectData[0].SitName = LLUtil.StringToPacketBytes(SitTitle); 3907 proper.ObjectData[0].SitName = Util.StringToBytes256(SitTitle);
3952 proper.ObjectData[0].Name = LLUtil.StringToPacketBytes(ItemName); 3908 proper.ObjectData[0].Name = Util.StringToBytes256(ItemName);
3953 proper.ObjectData[0].Description = LLUtil.StringToPacketBytes(ItemDescription); 3909 proper.ObjectData[0].Description = Util.StringToBytes256(ItemDescription);
3954 proper.ObjectData[0].OwnerMask = OwnerMask; 3910 proper.ObjectData[0].OwnerMask = OwnerMask;
3955 proper.ObjectData[0].NextOwnerMask = NextOwnerMask; 3911 proper.ObjectData[0].NextOwnerMask = NextOwnerMask;
3956 proper.ObjectData[0].GroupMask = GroupMask; 3912 proper.ObjectData[0].GroupMask = GroupMask;
@@ -4191,11 +4147,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4191 4147
4192 updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; 4148 updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale;
4193 updatePacket.ParcelData.MediaID = landData.MediaID; 4149 updatePacket.ParcelData.MediaID = landData.MediaID;
4194 updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL); 4150 updatePacket.ParcelData.MediaURL = Util.StringToBytes256(landData.MediaURL);
4195 updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL); 4151 updatePacket.ParcelData.MusicURL = Util.StringToBytes256(landData.MusicURL);
4196 updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name); 4152 updatePacket.ParcelData.Name = Util.StringToBytes256(landData.Name);
4197 updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime; 4153 updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime;
4198 updatePacket.ParcelData.OtherCount = 0; //unemplemented 4154 updatePacket.ParcelData.OtherCount = 0; //TODO: Unimplemented
4199 updatePacket.ParcelData.OtherPrims = landData.OtherPrims; 4155 updatePacket.ParcelData.OtherPrims = landData.OtherPrims;
4200 updatePacket.ParcelData.OwnerID = landData.OwnerID; 4156 updatePacket.ParcelData.OwnerID = landData.OwnerID;
4201 updatePacket.ParcelData.OwnerPrims = landData.OwnerPrims; 4157 updatePacket.ParcelData.OwnerPrims = landData.OwnerPrims;
@@ -4203,22 +4159,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4203 updatePacket.ParcelData.ParcelPrimBonus = simObjectBonusFactor; 4159 updatePacket.ParcelData.ParcelPrimBonus = simObjectBonusFactor;
4204 updatePacket.ParcelData.PassHours = landData.PassHours; 4160 updatePacket.ParcelData.PassHours = landData.PassHours;
4205 updatePacket.ParcelData.PassPrice = landData.PassPrice; 4161 updatePacket.ParcelData.PassPrice = landData.PassPrice;
4206 updatePacket.ParcelData.PublicCount = 0; //unemplemented 4162 updatePacket.ParcelData.PublicCount = 0; //TODO: Unimplemented
4207 4163
4208 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)RegionFlags.DenyAnonymous) > 4164 updatePacket.ParcelData.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
4209 0); 4165 updatePacket.ParcelData.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0;
4210 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)RegionFlags.DenyIdentified) > 4166 updatePacket.ParcelData.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0;
4211 0); 4167 updatePacket.ParcelData.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
4212 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)RegionFlags.DenyTransacted) >
4213 0);
4214 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)RegionFlags.RestrictPushObject) >
4215 0);
4216 4168
4217 updatePacket.ParcelData.RentPrice = 0; 4169 updatePacket.ParcelData.RentPrice = 0;
4218 updatePacket.ParcelData.RequestResult = request_result; 4170 updatePacket.ParcelData.RequestResult = request_result;
4219 updatePacket.ParcelData.SalePrice = landData.SalePrice; 4171 updatePacket.ParcelData.SalePrice = landData.SalePrice;
4220 updatePacket.ParcelData.SelectedPrims = landData.SelectedPrims; 4172 updatePacket.ParcelData.SelectedPrims = landData.SelectedPrims;
4221 updatePacket.ParcelData.SelfCount = 0; //unemplemented 4173 updatePacket.ParcelData.SelfCount = 0; //TODO: Unimplemented
4222 updatePacket.ParcelData.SequenceID = sequence_id; 4174 updatePacket.ParcelData.SequenceID = sequence_id;
4223 if (landData.SimwideArea > 0) 4175 if (landData.SimwideArea > 0)
4224 { 4176 {
@@ -5265,18 +5217,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5265 m_udpClient.SetThrottles(throttles); 5217 m_udpClient.SetThrottles(throttles);
5266 } 5218 }
5267 5219
5220 /// <summary>
5221 /// Get the current throttles for this client as a packed byte array
5222 /// </summary>
5223 /// <param name="multiplier">Unused</param>
5224 /// <returns></returns>
5268 public byte[] GetThrottlesPacked(float multiplier) 5225 public byte[] GetThrottlesPacked(float multiplier)
5269 { 5226 {
5270 return m_udpClient.GetThrottlesPacked(); 5227 return m_udpClient.GetThrottlesPacked();
5271 } 5228 }
5272 5229
5273 public bool IsThrottleEmpty(ThrottleOutPacketType category)
5274 {
5275 return m_udpClient.IsThrottleEmpty(category);
5276 }
5277
5278 /// <summary> 5230 /// <summary>
5279 /// Unused 5231 /// Cruft?
5280 /// </summary> 5232 /// </summary>
5281 public virtual void InPacket(object NewPack) 5233 public virtual void InPacket(object NewPack)
5282 { 5234 {
@@ -6231,14 +6183,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6231 break; 6183 break;
6232 6184
6233 case PacketType.AgentPause: 6185 case PacketType.AgentPause:
6234 m_probesWithNoIngressPackets = 0; 6186 m_udpClient.IsPaused = true;
6235 m_clientBlocked = true;
6236 break; 6187 break;
6237 6188
6238 case PacketType.AgentResume: 6189 case PacketType.AgentResume:
6239 m_probesWithNoIngressPackets = 0; 6190 m_udpClient.IsPaused = false;
6240 m_clientBlocked = false; 6191 SendStartPingCheck(m_udpClient.CurrentPingSequence++);
6241 SendStartPingCheck(0);
6242 6192
6243 break; 6193 break;
6244 6194
@@ -8904,14 +8854,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8904 #region unimplemented handlers 8854 #region unimplemented handlers
8905 8855
8906 case PacketType.StartPingCheck: 8856 case PacketType.StartPingCheck:
8907 // Send the client the ping response back 8857 StartPingCheckPacket pingStart = (StartPingCheckPacket)Pack;
8908 // Pass the same PingID in the matching packet 8858 CompletePingCheckPacket pingComplete = new CompletePingCheckPacket();
8909 // Handled In the packet processing 8859 pingComplete.PingID.PingID = pingStart.PingID.PingID;
8910 //m_log.Debug("[CLIENT]: possibly unhandled StartPingCheck packet"); 8860 m_udpServer.SendPacket(m_udpClient, pingComplete, ThrottleOutPacketType.Unknown, false);
8911 break; 8861 break;
8862
8912 case PacketType.CompletePingCheck: 8863 case PacketType.CompletePingCheck:
8913 // TODO: Perhaps this should be processed on the Sim to determine whether or not to drop a dead client 8864 // TODO: Do stats tracking or something with these?
8914 //m_log.Warn("[CLIENT]: unhandled CompletePingCheck packet");
8915 break; 8865 break;
8916 8866
8917 case PacketType.ViewerStats: 8867 case PacketType.ViewerStats:
@@ -10209,14 +10159,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10209 return info; 10159 return info;
10210 } 10160 }
10211 10161
10212 public EndPoint GetClientEP() 10162 public void SetClientInfo(ClientInfo info)
10213 { 10163 {
10214 return m_userEndPoint; 10164 m_udpClient.SetClientInfo(info);
10215 } 10165 }
10216 10166
10217 public void SetClientInfo(ClientInfo info) 10167 public EndPoint GetClientEP()
10218 { 10168 {
10219 m_udpClient.SetClientInfo(info); 10169 return m_userEndPoint;
10220 } 10170 }
10221 10171
10222 #region Media Parcel Members 10172 #region Media Parcel Members