aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs618
1 files changed, 249 insertions, 369 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index d64f655..8487adc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -59,6 +59,209 @@ namespace OpenSim.Region.ClientStack.LindenUDP
59 /// </summary> 59 /// </summary>
60 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector 60 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
61 { 61 {
62 #region Events
63
64 public event GenericMessage OnGenericMessage;
65 public event BinaryGenericMessage OnBinaryGenericMessage;
66 public event Action<IClientAPI> OnLogout;
67 public event ObjectPermissions OnObjectPermissions;
68 public event Action<IClientAPI> OnConnectionClosed;
69 public event ViewerEffectEventHandler OnViewerEffect;
70 public event ImprovedInstantMessage OnInstantMessage;
71 public event ChatMessage OnChatFromClient;
72 public event TextureRequest OnRequestTexture;
73 public event RezObject OnRezObject;
74 public event DeRezObject OnDeRezObject;
75 public event ModifyTerrain OnModifyTerrain;
76 public event Action<IClientAPI> OnRegionHandShakeReply;
77 public event GenericCall2 OnRequestWearables;
78 public event SetAppearance OnSetAppearance;
79 public event AvatarNowWearing OnAvatarNowWearing;
80 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
81 public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
82 public event UUIDNameRequest OnDetachAttachmentIntoInv;
83 public event ObjectAttach OnObjectAttach;
84 public event ObjectDeselect OnObjectDetach;
85 public event ObjectDrop OnObjectDrop;
86 public event GenericCall2 OnCompleteMovementToRegion;
87 public event UpdateAgent OnAgentUpdate;
88 public event AgentRequestSit OnAgentRequestSit;
89 public event AgentSit OnAgentSit;
90 public event AvatarPickerRequest OnAvatarPickerRequest;
91 public event StartAnim OnStartAnim;
92 public event StopAnim OnStopAnim;
93 public event Action<IClientAPI> OnRequestAvatarsData;
94 public event LinkObjects OnLinkObjects;
95 public event DelinkObjects OnDelinkObjects;
96 public event GrabObject OnGrabObject;
97 public event DeGrabObject OnDeGrabObject;
98 public event SpinStart OnSpinStart;
99 public event SpinStop OnSpinStop;
100 public event ObjectDuplicate OnObjectDuplicate;
101 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
102 public event MoveObject OnGrabUpdate;
103 public event SpinObject OnSpinUpdate;
104 public event AddNewPrim OnAddPrim;
105 public event RequestGodlikePowers OnRequestGodlikePowers;
106 public event GodKickUser OnGodKickUser;
107 public event ObjectExtraParams OnUpdateExtraParams;
108 public event UpdateShape OnUpdatePrimShape;
109 public event ObjectRequest OnObjectRequest;
110 public event ObjectSelect OnObjectSelect;
111 public event ObjectDeselect OnObjectDeselect;
112 public event GenericCall7 OnObjectDescription;
113 public event GenericCall7 OnObjectName;
114 public event GenericCall7 OnObjectClickAction;
115 public event GenericCall7 OnObjectMaterial;
116 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
117 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
118 public event UpdatePrimFlags OnUpdatePrimFlags;
119 public event UpdatePrimTexture OnUpdatePrimTexture;
120 public event UpdateVector OnUpdatePrimGroupPosition;
121 public event UpdateVector OnUpdatePrimSinglePosition;
122 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
123 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
124 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
125 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
126 public event UpdateVector OnUpdatePrimScale;
127 public event UpdateVector OnUpdatePrimGroupScale;
128 public event StatusChange OnChildAgentStatus;
129 public event GenericCall2 OnStopMovement;
130 public event Action<UUID> OnRemoveAvatar;
131 public event RequestMapBlocks OnRequestMapBlocks;
132 public event RequestMapName OnMapNameRequest;
133 public event TeleportLocationRequest OnTeleportLocationRequest;
134 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
135 public event DisconnectUser OnDisconnectUser;
136 public event RequestAvatarProperties OnRequestAvatarProperties;
137 public event SetAlwaysRun OnSetAlwaysRun;
138 public event FetchInventory OnAgentDataUpdateRequest;
139 public event TeleportLocationRequest OnSetStartLocationRequest;
140 public event UpdateAvatarProperties OnUpdateAvatarProperties;
141 public event CreateNewInventoryItem OnCreateNewInventoryItem;
142 public event CreateInventoryFolder OnCreateNewInventoryFolder;
143 public event UpdateInventoryFolder OnUpdateInventoryFolder;
144 public event MoveInventoryFolder OnMoveInventoryFolder;
145 public event FetchInventoryDescendents OnFetchInventoryDescendents;
146 public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
147 public event FetchInventory OnFetchInventory;
148 public event RequestTaskInventory OnRequestTaskInventory;
149 public event UpdateInventoryItem OnUpdateInventoryItem;
150 public event CopyInventoryItem OnCopyInventoryItem;
151 public event MoveInventoryItem OnMoveInventoryItem;
152 public event RemoveInventoryItem OnRemoveInventoryItem;
153 public event RemoveInventoryFolder OnRemoveInventoryFolder;
154 public event UDPAssetUploadRequest OnAssetUploadRequest;
155 public event XferReceive OnXferReceive;
156 public event RequestXfer OnRequestXfer;
157 public event ConfirmXfer OnConfirmXfer;
158 public event AbortXfer OnAbortXfer;
159 public event RequestTerrain OnRequestTerrain;
160 public event RezScript OnRezScript;
161 public event UpdateTaskInventory OnUpdateTaskInventory;
162 public event MoveTaskInventory OnMoveTaskItem;
163 public event RemoveTaskInventory OnRemoveTaskItem;
164 public event RequestAsset OnRequestAsset;
165 public event UUIDNameRequest OnNameFromUUIDRequest;
166 public event ParcelAccessListRequest OnParcelAccessListRequest;
167 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
168 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
169 public event ParcelDivideRequest OnParcelDivideRequest;
170 public event ParcelJoinRequest OnParcelJoinRequest;
171 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
172 public event ParcelSelectObjects OnParcelSelectObjects;
173 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
174 public event ParcelAbandonRequest OnParcelAbandonRequest;
175 public event ParcelGodForceOwner OnParcelGodForceOwner;
176 public event ParcelReclaim OnParcelReclaim;
177 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
178 public event ParcelDeedToGroup OnParcelDeedToGroup;
179 public event RegionInfoRequest OnRegionInfoRequest;
180 public event EstateCovenantRequest OnEstateCovenantRequest;
181 public event FriendActionDelegate OnApproveFriendRequest;
182 public event FriendActionDelegate OnDenyFriendRequest;
183 public event FriendshipTermination OnTerminateFriendship;
184 public event MoneyTransferRequest OnMoneyTransferRequest;
185 public event EconomyDataRequest OnEconomyDataRequest;
186 public event MoneyBalanceRequest OnMoneyBalanceRequest;
187 public event ParcelBuy OnParcelBuy;
188 public event UUIDNameRequest OnTeleportHomeRequest;
189 public event UUIDNameRequest OnUUIDGroupNameRequest;
190 public event ScriptAnswer OnScriptAnswer;
191 public event RequestPayPrice OnRequestPayPrice;
192 public event ObjectSaleInfo OnObjectSaleInfo;
193 public event ObjectBuy OnObjectBuy;
194 public event BuyObjectInventory OnBuyObjectInventory;
195 public event AgentSit OnUndo;
196 public event ForceReleaseControls OnForceReleaseControls;
197 public event GodLandStatRequest OnLandStatRequest;
198 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
199 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
200 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
201 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
202 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
203 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
204 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
205 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
206 public event BakeTerrain OnBakeTerrain;
207 public event RequestTerrain OnUploadTerrain;
208 public event EstateChangeInfo OnEstateChangeInfo;
209 public event EstateRestartSimRequest OnEstateRestartSimRequest;
210 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
211 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
212 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
213 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
214 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
215 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
216 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
217 public event RegionHandleRequest OnRegionHandleRequest;
218 public event ParcelInfoRequest OnParcelInfoRequest;
219 public event ScriptReset OnScriptReset;
220 public event GetScriptRunning OnGetScriptRunning;
221 public event SetScriptRunning OnSetScriptRunning;
222 public event UpdateVector OnAutoPilotGo;
223 public event TerrainUnacked OnUnackedTerrain;
224 public event ActivateGesture OnActivateGesture;
225 public event DeactivateGesture OnDeactivateGesture;
226 public event ObjectOwner OnObjectOwner;
227 public event DirPlacesQuery OnDirPlacesQuery;
228 public event DirFindQuery OnDirFindQuery;
229 public event DirLandQuery OnDirLandQuery;
230 public event DirPopularQuery OnDirPopularQuery;
231 public event DirClassifiedQuery OnDirClassifiedQuery;
232 public event EventInfoRequest OnEventInfoRequest;
233 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
234 public event MapItemRequest OnMapItemRequest;
235 public event OfferCallingCard OnOfferCallingCard;
236 public event AcceptCallingCard OnAcceptCallingCard;
237 public event DeclineCallingCard OnDeclineCallingCard;
238 public event SoundTrigger OnSoundTrigger;
239 public event StartLure OnStartLure;
240 public event TeleportLureRequest OnTeleportLureRequest;
241 public event NetworkStats OnNetworkStatsUpdate;
242 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
243 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
244 public event ClassifiedDelete OnClassifiedDelete;
245 public event ClassifiedDelete OnClassifiedGodDelete;
246 public event EventNotificationAddRequest OnEventNotificationAddRequest;
247 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
248 public event EventGodDelete OnEventGodDelete;
249 public event ParcelDwellRequest OnParcelDwellRequest;
250 public event UserInfoRequest OnUserInfoRequest;
251 public event UpdateUserInfo OnUpdateUserInfo;
252 public event RetrieveInstantMessages OnRetrieveInstantMessages;
253 public event PickDelete OnPickDelete;
254 public event PickGodDelete OnPickGodDelete;
255 public event PickInfoUpdate OnPickInfoUpdate;
256 public event AvatarNotesUpdate OnAvatarNotesUpdate;
257 public event MuteListRequest OnMuteListRequest;
258 public event AvatarInterestUpdate OnAvatarInterestUpdate;
259 public event PlacesQuery OnPlacesQuery;
260
261 #endregion Events
262
263 #region Class Members
264
62 // LLClientView Only 265 // LLClientView Only
63 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args); 266 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
64 267
@@ -111,17 +314,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
111 protected int m_primFullUpdatesPerPacket = 14; 314 protected int m_primFullUpdatesPerPacket = 14;
112 protected int m_primTerseUpdateRate = 10; 315 protected int m_primTerseUpdateRate = 10;
113 protected int m_primFullUpdateRate = 14; 316 protected int m_primFullUpdateRate = 14;
114 protected int m_textureSendLimit = 20;
115 protected int m_textureDataLimit = 10;
116 protected int m_avatarTerseUpdateRate = 50; 317 protected int m_avatarTerseUpdateRate = 50;
117 protected int m_avatarTerseUpdatesPerPacket = 5; 318 protected int m_avatarTerseUpdatesPerPacket = 5;
118 protected int m_packetMTU = 1400; 319 /// <summary>Number of texture packets to put on the queue each time the
320 /// OnQueueEmpty event is triggered for the texture category</summary>
321 protected int m_textureSendLimit = 20;
119 protected IAssetService m_assetService; 322 protected IAssetService m_assetService;
120 private IHyperAssetService m_hyperAssets; 323 private IHyperAssetService m_hyperAssets;
121 324
122 325
326 #endregion Class Members
327
123 #region Properties 328 #region Properties
124 329
330 public LLUDPClient UDPClient { get { return m_udpClient; } }
331 public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } }
125 public UUID SecureSessionId { get { return m_secureSessionId; } } 332 public UUID SecureSessionId { get { return m_secureSessionId; } }
126 public IScene Scene { get { return m_scene; } } 333 public IScene Scene { get { return m_scene; } }
127 public UUID SessionId { get { return m_sessionId; } } 334 public UUID SessionId { get { return m_sessionId; } }
@@ -202,51 +409,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
202 #region Client Methods 409 #region Client Methods
203 410
204 /// <summary> 411 /// <summary>
205 /// Close down the client view. This *must* be the last method called, since the last # 412 /// Shut down the client view
206 /// statement of CloseCleanup() aborts the thread.
207 /// </summary> 413 /// </summary>
208 /// <param name="shutdownCircuit"></param> 414 public void Close()
209 public void Close(bool shutdownCircuit)
210 { 415 {
211 m_log.DebugFormat( 416 m_log.DebugFormat(
212 "[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}", 417 "[CLIENT]: Close has been called for {0} attached to scene {1}",
213 shutdownCircuit, Name, m_scene.RegionInfo.RegionName); 418 Name, m_scene.RegionInfo.RegionName);
214 419
420 // Send the STOP packet
421 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
422 OutPacket(disable, ThrottleOutPacketType.Unknown);
423
424 IsActive = false;
425
426 // Shutdown the image manager
215 if (m_imageManager != null) 427 if (m_imageManager != null)
216 m_imageManager.Close(); 428 m_imageManager.Close();
217 429
430 // Fire the callback for this connection closing
431 if (OnConnectionClosed != null)
432 OnConnectionClosed(this);
433
434 // Flush all of the packets out of the UDP server for this client
218 if (m_udpServer != null) 435 if (m_udpServer != null)
219 m_udpServer.Flush(); 436 m_udpServer.Flush(m_udpClient);
220
221 // raise an event on the packet server to Shutdown the circuit
222 // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup
223 // here otherwise we'll end up calling it twice.
224 // FIXME: In truth, I might be wrong but this whole business of calling this method twice (with different args) looks
225 // horribly tangly. Hopefully it should be possible to greatly simplify it.
226 if (shutdownCircuit)
227 {
228 if (OnConnectionClosed != null)
229 OnConnectionClosed(this);
230 }
231 else
232 {
233 CloseCleanup(shutdownCircuit);
234 }
235 }
236 437
237 private void CloseCleanup(bool shutdownCircuit) 438 // Remove ourselves from the scene
238 {
239 m_scene.RemoveClient(AgentId); 439 m_scene.RemoveClient(AgentId);
240 440
241 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
242 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
243
244 // Send the STOP packet
245 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
246 OutPacket(disable, ThrottleOutPacketType.Unknown);
247
248 Thread.Sleep(2000);
249
250 // Shut down timers. Thread Context of this method is murky. Lock all timers 441 // Shut down timers. Thread Context of this method is murky. Lock all timers
251 if (m_avatarTerseUpdateTimer.Enabled) 442 if (m_avatarTerseUpdateTimer.Enabled)
252 lock (m_avatarTerseUpdateTimer) 443 lock (m_avatarTerseUpdateTimer)
@@ -258,43 +449,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
258 lock (m_primFullUpdateTimer) 449 lock (m_primFullUpdateTimer)
259 m_primFullUpdateTimer.Stop(); 450 m_primFullUpdateTimer.Stop();
260 451
261 // This is just to give the client a reasonable chance of
262 // flushing out all it's packets. There should probably
263 // be a better mechanism here
264
265 // We can't reach into other scenes and close the connection 452 // We can't reach into other scenes and close the connection
266 // We need to do this over grid communications 453 // We need to do this over grid communications
267 //m_scene.CloseAllAgents(CircuitCode); 454 //m_scene.CloseAllAgents(CircuitCode);
268 455
269 // If we're not shutting down the circuit, then this is the last time we'll go here. 456 m_avatarTerseUpdateTimer.Dispose();
270 // If we are shutting down the circuit, the UDP Server will come back here with 457 m_primTerseUpdateTimer.Dispose();
271 // ShutDownCircuit = false 458 m_primFullUpdateTimer.Dispose();
272 if (!(shutdownCircuit))
273 {
274 GC.Collect();
275 m_imageManager = null;
276 // Sends a KillPacket object, with which, the
277 // blockingqueue dequeues and sees it's a killpacket
278 // and terminates within the context of the client thread.
279 // This ensures that it's done from within the context
280 // of the client thread regardless of where Close() is called.
281 KillEndDone();
282 }
283
284 IsActive = false;
285
286 m_avatarTerseUpdateTimer.Close();
287 m_primTerseUpdateTimer.Close();
288 m_primFullUpdateTimer.Close();
289 459
290 //m_udpServer.OnPacketStats -= PopulateStats; 460 // Disable UDP handling for this client
291 m_udpClient.Shutdown(); 461 m_udpClient.Shutdown();
292 462
293 // wait for thread stoped 463 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
294 // m_clientThread.Join(); 464 //GC.Collect();
295 465 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
296 // delete circuit code
297 //m_networkServer.CloseClient(this);
298 } 466 }
299 467
300 public void Kick(string message) 468 public void Kick(string message)
@@ -416,43 +584,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
416 return result; 584 return result;
417 } 585 }
418 586
419 /*protected void DebugPacket(string direction, Packet packet)
420 {
421 string info;
422
423 if (m_debugPacketLevel < 255 && packet.Type == PacketType.AgentUpdate)
424 return;
425 if (m_debugPacketLevel < 254 && packet.Type == PacketType.ViewerEffect)
426 return;
427 if (m_debugPacketLevel < 253 && (
428 packet.Type == PacketType.CompletePingCheck ||
429 packet.Type == PacketType.StartPingCheck
430 ))
431 return;
432 if (m_debugPacketLevel < 252 && packet.Type == PacketType.PacketAck)
433 return;
434
435 if (m_debugPacketLevel > 1)
436 {
437 info = packet.ToString();
438 }
439 else
440 {
441 info = packet.Type.ToString();
442 }
443
444 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
445 }*/
446
447 #endregion Packet Handling 587 #endregion Packet Handling
448 588
449 # region Setup 589 # region Setup
450 590
451 /// <summary> 591 public virtual void Start()
452 /// Starts up the timers to check the client and resend unacked packets
453 /// Adds the client to the OpenSim.Region.Framework.Scenes.Scene
454 /// </summary>
455 protected virtual void InitNewClient()
456 { 592 {
457 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); 593 m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate);
458 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); 594 m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates);
@@ -471,262 +607,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
471 RefreshGroupMembership(); 607 RefreshGroupMembership();
472 } 608 }
473 609
474 public virtual void Start()
475 {
476 // This sets up all the timers
477 InitNewClient();
478 }
479
480 /// <summary>
481 /// Run a user session. This method lies at the base of the entire client thread.
482 /// </summary>
483 protected void RunUserSession()
484 {
485 try
486 {
487
488 }
489 catch (Exception e)
490 {
491 if (e is ThreadAbortException)
492 throw;
493
494 if (StatsManager.SimExtraStats != null)
495 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
496
497 // Don't let a failure in an individual client thread crash the whole sim.
498 m_log.ErrorFormat(
499 "[CLIENT]: Client thread for {0} {1} crashed. Logging them out.", Name, AgentId);
500 m_log.Error(e.ToString());
501
502 try
503 {
504 // Make an attempt to alert the user that their session has crashed
505 AgentAlertMessagePacket packet
506 = BuildAgentAlertPacket(
507 "Unfortunately the session for this client on the server has crashed.\n"
508 + "Any further actions taken will not be processed.\n"
509 + "Please relog", true);
510
511 m_udpServer.SendPacket(m_agentId, packet, ThrottleOutPacketType.Unknown, false);
512
513 // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to
514 // listeners yet, though.
515 Logout(this);
516 }
517 catch (Exception e2)
518 {
519 if (e2 is ThreadAbortException)
520 throw;
521
522 m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2);
523 }
524 }
525 }
526
527 # endregion 610 # endregion
528 611
529 #region Events
530
531 public event GenericMessage OnGenericMessage;
532 public event BinaryGenericMessage OnBinaryGenericMessage;
533 public event Action<IClientAPI> OnLogout;
534 public event ObjectPermissions OnObjectPermissions;
535 public event Action<IClientAPI> OnConnectionClosed;
536 public event ViewerEffectEventHandler OnViewerEffect;
537 public event ImprovedInstantMessage OnInstantMessage;
538 public event ChatMessage OnChatFromClient;
539 public event TextureRequest OnRequestTexture;
540 public event RezObject OnRezObject;
541 public event DeRezObject OnDeRezObject;
542 public event ModifyTerrain OnModifyTerrain;
543 public event Action<IClientAPI> OnRegionHandShakeReply;
544 public event GenericCall2 OnRequestWearables;
545 public event SetAppearance OnSetAppearance;
546 public event AvatarNowWearing OnAvatarNowWearing;
547 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
548 public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
549 public event UUIDNameRequest OnDetachAttachmentIntoInv;
550 public event ObjectAttach OnObjectAttach;
551 public event ObjectDeselect OnObjectDetach;
552 public event ObjectDrop OnObjectDrop;
553 public event GenericCall2 OnCompleteMovementToRegion;
554 public event UpdateAgent OnAgentUpdate;
555 public event AgentRequestSit OnAgentRequestSit;
556 public event AgentSit OnAgentSit;
557 public event AvatarPickerRequest OnAvatarPickerRequest;
558 public event StartAnim OnStartAnim;
559 public event StopAnim OnStopAnim;
560 public event Action<IClientAPI> OnRequestAvatarsData;
561 public event LinkObjects OnLinkObjects;
562 public event DelinkObjects OnDelinkObjects;
563 public event GrabObject OnGrabObject;
564 public event DeGrabObject OnDeGrabObject;
565 public event SpinStart OnSpinStart;
566 public event SpinStop OnSpinStop;
567 public event ObjectDuplicate OnObjectDuplicate;
568 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
569 public event MoveObject OnGrabUpdate;
570 public event SpinObject OnSpinUpdate;
571 public event AddNewPrim OnAddPrim;
572 public event RequestGodlikePowers OnRequestGodlikePowers;
573 public event GodKickUser OnGodKickUser;
574 public event ObjectExtraParams OnUpdateExtraParams;
575 public event UpdateShape OnUpdatePrimShape;
576 public event ObjectRequest OnObjectRequest;
577 public event ObjectSelect OnObjectSelect;
578 public event ObjectDeselect OnObjectDeselect;
579 public event GenericCall7 OnObjectDescription;
580 public event GenericCall7 OnObjectName;
581 public event GenericCall7 OnObjectClickAction;
582 public event GenericCall7 OnObjectMaterial;
583 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
584 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
585 public event UpdatePrimFlags OnUpdatePrimFlags;
586 public event UpdatePrimTexture OnUpdatePrimTexture;
587 public event UpdateVector OnUpdatePrimGroupPosition;
588 public event UpdateVector OnUpdatePrimSinglePosition;
589 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
590 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
591 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
592 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
593 public event UpdateVector OnUpdatePrimScale;
594 public event UpdateVector OnUpdatePrimGroupScale;
595 public event StatusChange OnChildAgentStatus;
596 public event GenericCall2 OnStopMovement;
597 public event Action<UUID> OnRemoveAvatar;
598 public event RequestMapBlocks OnRequestMapBlocks;
599 public event RequestMapName OnMapNameRequest;
600 public event TeleportLocationRequest OnTeleportLocationRequest;
601 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
602 public event DisconnectUser OnDisconnectUser;
603 public event RequestAvatarProperties OnRequestAvatarProperties;
604 public event SetAlwaysRun OnSetAlwaysRun;
605 public event FetchInventory OnAgentDataUpdateRequest;
606 public event TeleportLocationRequest OnSetStartLocationRequest;
607 public event UpdateAvatarProperties OnUpdateAvatarProperties;
608 public event CreateNewInventoryItem OnCreateNewInventoryItem;
609 public event CreateInventoryFolder OnCreateNewInventoryFolder;
610 public event UpdateInventoryFolder OnUpdateInventoryFolder;
611 public event MoveInventoryFolder OnMoveInventoryFolder;
612 public event FetchInventoryDescendents OnFetchInventoryDescendents;
613 public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
614 public event FetchInventory OnFetchInventory;
615 public event RequestTaskInventory OnRequestTaskInventory;
616 public event UpdateInventoryItem OnUpdateInventoryItem;
617 public event CopyInventoryItem OnCopyInventoryItem;
618 public event MoveInventoryItem OnMoveInventoryItem;
619 public event RemoveInventoryItem OnRemoveInventoryItem;
620 public event RemoveInventoryFolder OnRemoveInventoryFolder;
621 public event UDPAssetUploadRequest OnAssetUploadRequest;
622 public event XferReceive OnXferReceive;
623 public event RequestXfer OnRequestXfer;
624 public event ConfirmXfer OnConfirmXfer;
625 public event AbortXfer OnAbortXfer;
626 public event RequestTerrain OnRequestTerrain;
627 public event RezScript OnRezScript;
628 public event UpdateTaskInventory OnUpdateTaskInventory;
629 public event MoveTaskInventory OnMoveTaskItem;
630 public event RemoveTaskInventory OnRemoveTaskItem;
631 public event RequestAsset OnRequestAsset;
632 public event UUIDNameRequest OnNameFromUUIDRequest;
633 public event ParcelAccessListRequest OnParcelAccessListRequest;
634 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
635 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
636 public event ParcelDivideRequest OnParcelDivideRequest;
637 public event ParcelJoinRequest OnParcelJoinRequest;
638 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
639 public event ParcelSelectObjects OnParcelSelectObjects;
640 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
641 public event ParcelAbandonRequest OnParcelAbandonRequest;
642 public event ParcelGodForceOwner OnParcelGodForceOwner;
643 public event ParcelReclaim OnParcelReclaim;
644 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
645 public event ParcelDeedToGroup OnParcelDeedToGroup;
646 public event RegionInfoRequest OnRegionInfoRequest;
647 public event EstateCovenantRequest OnEstateCovenantRequest;
648 public event FriendActionDelegate OnApproveFriendRequest;
649 public event FriendActionDelegate OnDenyFriendRequest;
650 public event FriendshipTermination OnTerminateFriendship;
651 public event MoneyTransferRequest OnMoneyTransferRequest;
652 public event EconomyDataRequest OnEconomyDataRequest;
653 public event MoneyBalanceRequest OnMoneyBalanceRequest;
654 public event ParcelBuy OnParcelBuy;
655 public event UUIDNameRequest OnTeleportHomeRequest;
656 public event UUIDNameRequest OnUUIDGroupNameRequest;
657 public event ScriptAnswer OnScriptAnswer;
658 public event RequestPayPrice OnRequestPayPrice;
659 public event ObjectSaleInfo OnObjectSaleInfo;
660 public event ObjectBuy OnObjectBuy;
661 public event BuyObjectInventory OnBuyObjectInventory;
662 public event AgentSit OnUndo;
663 public event ForceReleaseControls OnForceReleaseControls;
664 public event GodLandStatRequest OnLandStatRequest;
665 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
666 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
667 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
668 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
669 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
670 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
671 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
672 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
673 public event BakeTerrain OnBakeTerrain;
674 public event RequestTerrain OnUploadTerrain;
675 public event EstateChangeInfo OnEstateChangeInfo;
676 public event EstateRestartSimRequest OnEstateRestartSimRequest;
677 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
678 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
679 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
680 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
681 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
682 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
683 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
684 public event RegionHandleRequest OnRegionHandleRequest;
685 public event ParcelInfoRequest OnParcelInfoRequest;
686 public event ScriptReset OnScriptReset;
687 public event GetScriptRunning OnGetScriptRunning;
688 public event SetScriptRunning OnSetScriptRunning;
689 public event UpdateVector OnAutoPilotGo;
690 public event TerrainUnacked OnUnackedTerrain;
691 public event ActivateGesture OnActivateGesture;
692 public event DeactivateGesture OnDeactivateGesture;
693 public event ObjectOwner OnObjectOwner;
694 public event DirPlacesQuery OnDirPlacesQuery;
695 public event DirFindQuery OnDirFindQuery;
696 public event DirLandQuery OnDirLandQuery;
697 public event DirPopularQuery OnDirPopularQuery;
698 public event DirClassifiedQuery OnDirClassifiedQuery;
699 public event EventInfoRequest OnEventInfoRequest;
700 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
701 public event MapItemRequest OnMapItemRequest;
702 public event OfferCallingCard OnOfferCallingCard;
703 public event AcceptCallingCard OnAcceptCallingCard;
704 public event DeclineCallingCard OnDeclineCallingCard;
705 public event SoundTrigger OnSoundTrigger;
706 public event StartLure OnStartLure;
707 public event TeleportLureRequest OnTeleportLureRequest;
708 public event NetworkStats OnNetworkStatsUpdate;
709 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
710 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
711 public event ClassifiedDelete OnClassifiedDelete;
712 public event ClassifiedDelete OnClassifiedGodDelete;
713 public event EventNotificationAddRequest OnEventNotificationAddRequest;
714 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
715 public event EventGodDelete OnEventGodDelete;
716 public event ParcelDwellRequest OnParcelDwellRequest;
717 public event UserInfoRequest OnUserInfoRequest;
718 public event UpdateUserInfo OnUpdateUserInfo;
719 public event RetrieveInstantMessages OnRetrieveInstantMessages;
720 public event PickDelete OnPickDelete;
721 public event PickGodDelete OnPickGodDelete;
722 public event PickInfoUpdate OnPickInfoUpdate;
723 public event AvatarNotesUpdate OnAvatarNotesUpdate;
724 public event MuteListRequest OnMuteListRequest;
725 public event AvatarInterestUpdate OnAvatarInterestUpdate;
726 public event PlacesQuery OnPlacesQuery;
727
728 #endregion Events
729
730 public void ActivateGesture(UUID assetId, UUID gestureId) 612 public void ActivateGesture(UUID assetId, UUID gestureId)
731 { 613 {
732 } 614 }
@@ -1346,7 +1228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1346 kill.ObjectData[0].ID = localID; 1228 kill.ObjectData[0].ID = localID;
1347 kill.Header.Reliable = true; 1229 kill.Header.Reliable = true;
1348 kill.Header.Zerocoded = true; 1230 kill.Header.Zerocoded = true;
1349 OutPacket(kill, ThrottleOutPacketType.Task); 1231 OutPacket(kill, ThrottleOutPacketType.State);
1350 } 1232 }
1351 1233
1352 /// <summary> 1234 /// <summary>
@@ -1940,7 +1822,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1940 sendXfer.XferID.ID = xferID; 1822 sendXfer.XferID.ID = xferID;
1941 sendXfer.XferID.Packet = packet; 1823 sendXfer.XferID.Packet = packet;
1942 sendXfer.DataPacket.Data = data; 1824 sendXfer.DataPacket.Data = data;
1943 OutPacket(sendXfer, ThrottleOutPacketType.Task); 1825 OutPacket(sendXfer, ThrottleOutPacketType.Asset);
1944 } 1826 }
1945 1827
1946 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, 1828 public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
@@ -2222,7 +2104,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2222 packet.AgentData.SessionID = SessionId; 2104 packet.AgentData.SessionID = SessionId;
2223 packet.Header.Reliable = false; 2105 packet.Header.Reliable = false;
2224 packet.Header.Zerocoded = true; 2106 packet.Header.Zerocoded = true;
2225 OutPacket(packet, ThrottleOutPacketType.Task); 2107 OutPacket(packet, ThrottleOutPacketType.State);
2226 } 2108 }
2227 2109
2228 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, 2110 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember,
@@ -3245,7 +3127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3245 3127
3246 avp.Sender.IsTrial = false; 3128 avp.Sender.IsTrial = false;
3247 avp.Sender.ID = agentID; 3129 avp.Sender.ID = agentID;
3248 OutPacket(avp, ThrottleOutPacketType.Task); 3130 OutPacket(avp, ThrottleOutPacketType.State);
3249 } 3131 }
3250 3132
3251 public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) 3133 public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
@@ -3370,7 +3252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3370 int length = 0; 3252 int length = 0;
3371 m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length); 3253 m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length);
3372 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); 3254 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3373 if (size + length > m_packetMTU) 3255 if (size + length > Packet.MTU)
3374 break; 3256 break;
3375 size += length; 3257 size += length;
3376 } 3258 }
@@ -3385,6 +3267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3385 3267
3386 terse.Header.Reliable = false; 3268 terse.Header.Reliable = false;
3387 terse.Header.Zerocoded = true; 3269 terse.Header.Zerocoded = true;
3270 // FIXME: Move this to ThrottleOutPacketType.State when the real prioritization code is committed
3388 OutPacket(terse, ThrottleOutPacketType.Task); 3271 OutPacket(terse, ThrottleOutPacketType.Task);
3389 3272
3390 if (m_avatarTerseUpdates.Count == 0) 3273 if (m_avatarTerseUpdates.Count == 0)
@@ -3575,7 +3458,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3575 void ProcessTextureRequests() 3458 void ProcessTextureRequests()
3576 { 3459 {
3577 if (m_imageManager != null) 3460 if (m_imageManager != null)
3578 m_imageManager.ProcessImageQueue(m_textureSendLimit, m_textureDataLimit); 3461 m_imageManager.ProcessImageQueue(m_textureSendLimit);
3579 } 3462 }
3580 3463
3581 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) 3464 void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
@@ -3614,7 +3497,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3614 int length = 0; 3497 int length = 0;
3615 m_primFullUpdates[count].ToBytes(blockbuffer, ref length); 3498 m_primFullUpdates[count].ToBytes(blockbuffer, ref length);
3616 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); 3499 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3617 if (size + length > m_packetMTU) 3500 if (size + length > Packet.MTU)
3618 break; 3501 break;
3619 size += length; 3502 size += length;
3620 } 3503 }
@@ -3629,7 +3512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3629 } 3512 }
3630 3513
3631 outPacket.Header.Zerocoded = true; 3514 outPacket.Header.Zerocoded = true;
3632 OutPacket(outPacket, ThrottleOutPacketType.Task); 3515 OutPacket(outPacket, ThrottleOutPacketType.State);
3633 3516
3634 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) 3517 if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
3635 lock (m_primFullUpdateTimer) 3518 lock (m_primFullUpdateTimer)
@@ -3702,7 +3585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3702 int length = 0; 3585 int length = 0;
3703 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); 3586 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
3704 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); 3587 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3705 if (size + length > m_packetMTU) 3588 if (size + length > Packet.MTU)
3706 break; 3589 break;
3707 size += length; 3590 size += length;
3708 } 3591 }
@@ -3719,7 +3602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3719 3602
3720 outPacket.Header.Reliable = false; 3603 outPacket.Header.Reliable = false;
3721 outPacket.Header.Zerocoded = true; 3604 outPacket.Header.Zerocoded = true;
3722 OutPacket(outPacket, ThrottleOutPacketType.Task); 3605 OutPacket(outPacket, ThrottleOutPacketType.State);
3723 3606
3724 if (m_primTerseUpdates.Count == 0) 3607 if (m_primTerseUpdates.Count == 0)
3725 lock (m_primTerseUpdateTimer) 3608 lock (m_primTerseUpdateTimer)
@@ -4805,7 +4688,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4805 4688
4806 public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) 4689 public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack)
4807 { 4690 {
4808
4809 ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack; 4691 ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack;
4810 if (ogpack.AgentData.SessionID != SessionId) return false; 4692 if (ogpack.AgentData.SessionID != SessionId) return false;
4811 4693
@@ -10252,7 +10134,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10252 10134
10253 public void KillEndDone() 10135 public void KillEndDone()
10254 { 10136 {
10255 m_udpClient.Shutdown();
10256 } 10137 }
10257 10138
10258 #region IClientCore 10139 #region IClientCore
@@ -10295,15 +10176,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10295 { 10176 {
10296 Kick(reason); 10177 Kick(reason);
10297 Thread.Sleep(1000); 10178 Thread.Sleep(1000);
10298 Close(true); 10179 Close();
10299 } 10180 }
10300 10181
10301 public void Disconnect() 10182 public void Disconnect()
10302 { 10183 {
10303 Close(true); 10184 Close();
10304 } 10185 }
10305 10186
10306
10307 #endregion 10187 #endregion
10308 10188
10309 public void RefreshGroupMembership() 10189 public void RefreshGroupMembership()