diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 668 |
1 files changed, 288 insertions, 380 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 84e705a..8487adc 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -43,6 +43,7 @@ using OpenSim.Framework.Communications.Cache; | |||
43 | using OpenSim.Framework.Statistics; | 43 | using OpenSim.Framework.Statistics; |
44 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
45 | using OpenSim.Region.Framework.Scenes; | 45 | using OpenSim.Region.Framework.Scenes; |
46 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
46 | using OpenSim.Services.Interfaces; | 47 | using OpenSim.Services.Interfaces; |
47 | using Timer=System.Timers.Timer; | 48 | using Timer=System.Timers.Timer; |
48 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 49 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
@@ -58,6 +59,209 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
58 | /// </summary> | 59 | /// </summary> |
59 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector | 60 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector |
60 | { | 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 | |||
61 | // LLClientView Only | 265 | // LLClientView Only |
62 | public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args); | 266 | public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args); |
63 | 267 | ||
@@ -110,15 +314,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
110 | protected int m_primFullUpdatesPerPacket = 14; | 314 | protected int m_primFullUpdatesPerPacket = 14; |
111 | protected int m_primTerseUpdateRate = 10; | 315 | protected int m_primTerseUpdateRate = 10; |
112 | protected int m_primFullUpdateRate = 14; | 316 | protected int m_primFullUpdateRate = 14; |
113 | protected int m_textureSendLimit = 20; | ||
114 | protected int m_textureDataLimit = 10; | ||
115 | protected int m_avatarTerseUpdateRate = 50; | 317 | protected int m_avatarTerseUpdateRate = 50; |
116 | protected int m_avatarTerseUpdatesPerPacket = 5; | 318 | protected int m_avatarTerseUpdatesPerPacket = 5; |
117 | 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; | ||
118 | protected IAssetService m_assetService; | 322 | protected IAssetService m_assetService; |
323 | private IHyperAssetService m_hyperAssets; | ||
324 | |||
325 | |||
326 | #endregion Class Members | ||
119 | 327 | ||
120 | #region Properties | 328 | #region Properties |
121 | 329 | ||
330 | public LLUDPClient UDPClient { get { return m_udpClient; } } | ||
331 | public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } | ||
122 | public UUID SecureSessionId { get { return m_secureSessionId; } } | 332 | public UUID SecureSessionId { get { return m_secureSessionId; } } |
123 | public IScene Scene { get { return m_scene; } } | 333 | public IScene Scene { get { return m_scene; } } |
124 | public UUID SessionId { get { return m_sessionId; } } | 334 | public UUID SessionId { get { return m_sessionId; } } |
@@ -170,6 +380,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
170 | 380 | ||
171 | m_scene = scene; | 381 | m_scene = scene; |
172 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 382 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
383 | m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>(); | ||
173 | m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); | 384 | m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); |
174 | m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); | 385 | m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); |
175 | m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); | 386 | m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); |
@@ -198,51 +409,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
198 | #region Client Methods | 409 | #region Client Methods |
199 | 410 | ||
200 | /// <summary> | 411 | /// <summary> |
201 | /// Close down the client view. This *must* be the last method called, since the last # | 412 | /// Shut down the client view |
202 | /// statement of CloseCleanup() aborts the thread. | ||
203 | /// </summary> | 413 | /// </summary> |
204 | /// <param name="shutdownCircuit"></param> | 414 | public void Close() |
205 | public void Close(bool shutdownCircuit) | ||
206 | { | 415 | { |
207 | m_log.DebugFormat( | 416 | m_log.DebugFormat( |
208 | "[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}", |
209 | shutdownCircuit, Name, m_scene.RegionInfo.RegionName); | 418 | Name, m_scene.RegionInfo.RegionName); |
419 | |||
420 | // Send the STOP packet | ||
421 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
422 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
423 | |||
424 | IsActive = false; | ||
210 | 425 | ||
426 | // Shutdown the image manager | ||
211 | if (m_imageManager != null) | 427 | if (m_imageManager != null) |
212 | m_imageManager.Close(); | 428 | m_imageManager.Close(); |
213 | 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 | ||
214 | if (m_udpServer != null) | 435 | if (m_udpServer != null) |
215 | m_udpServer.Flush(); | 436 | m_udpServer.Flush(m_udpClient); |
216 | |||
217 | // raise an event on the packet server to Shutdown the circuit | ||
218 | // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup | ||
219 | // here otherwise we'll end up calling it twice. | ||
220 | // FIXME: In truth, I might be wrong but this whole business of calling this method twice (with different args) looks | ||
221 | // horribly tangly. Hopefully it should be possible to greatly simplify it. | ||
222 | if (shutdownCircuit) | ||
223 | { | ||
224 | if (OnConnectionClosed != null) | ||
225 | OnConnectionClosed(this); | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | CloseCleanup(shutdownCircuit); | ||
230 | } | ||
231 | } | ||
232 | 437 | ||
233 | private void CloseCleanup(bool shutdownCircuit) | 438 | // Remove ourselves from the scene |
234 | { | ||
235 | m_scene.RemoveClient(AgentId); | 439 | m_scene.RemoveClient(AgentId); |
236 | 440 | ||
237 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | ||
238 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | ||
239 | |||
240 | // Send the STOP packet | ||
241 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
242 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
243 | |||
244 | Thread.Sleep(2000); | ||
245 | |||
246 | // 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 |
247 | if (m_avatarTerseUpdateTimer.Enabled) | 442 | if (m_avatarTerseUpdateTimer.Enabled) |
248 | lock (m_avatarTerseUpdateTimer) | 443 | lock (m_avatarTerseUpdateTimer) |
@@ -254,43 +449,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
254 | lock (m_primFullUpdateTimer) | 449 | lock (m_primFullUpdateTimer) |
255 | m_primFullUpdateTimer.Stop(); | 450 | m_primFullUpdateTimer.Stop(); |
256 | 451 | ||
257 | // This is just to give the client a reasonable chance of | ||
258 | // flushing out all it's packets. There should probably | ||
259 | // be a better mechanism here | ||
260 | |||
261 | // We can't reach into other scenes and close the connection | 452 | // We can't reach into other scenes and close the connection |
262 | // We need to do this over grid communications | 453 | // We need to do this over grid communications |
263 | //m_scene.CloseAllAgents(CircuitCode); | 454 | //m_scene.CloseAllAgents(CircuitCode); |
264 | 455 | ||
265 | // If we're not shutting down the circuit, then this is the last time we'll go here. | 456 | m_avatarTerseUpdateTimer.Dispose(); |
266 | // If we are shutting down the circuit, the UDP Server will come back here with | 457 | m_primTerseUpdateTimer.Dispose(); |
267 | // ShutDownCircuit = false | 458 | m_primFullUpdateTimer.Dispose(); |
268 | if (!(shutdownCircuit)) | ||
269 | { | ||
270 | GC.Collect(); | ||
271 | m_imageManager = null; | ||
272 | // Sends a KillPacket object, with which, the | ||
273 | // blockingqueue dequeues and sees it's a killpacket | ||
274 | // and terminates within the context of the client thread. | ||
275 | // This ensures that it's done from within the context | ||
276 | // of the client thread regardless of where Close() is called. | ||
277 | KillEndDone(); | ||
278 | } | ||
279 | |||
280 | IsActive = false; | ||
281 | |||
282 | m_avatarTerseUpdateTimer.Close(); | ||
283 | m_primTerseUpdateTimer.Close(); | ||
284 | m_primFullUpdateTimer.Close(); | ||
285 | 459 | ||
286 | //m_udpServer.OnPacketStats -= PopulateStats; | 460 | // Disable UDP handling for this client |
287 | m_udpClient.Shutdown(); | 461 | m_udpClient.Shutdown(); |
288 | 462 | ||
289 | // wait for thread stoped | 463 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
290 | // m_clientThread.Join(); | 464 | //GC.Collect(); |
291 | 465 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | |
292 | // delete circuit code | ||
293 | //m_networkServer.CloseClient(this); | ||
294 | } | 466 | } |
295 | 467 | ||
296 | public void Kick(string message) | 468 | public void Kick(string message) |
@@ -412,43 +584,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
412 | return result; | 584 | return result; |
413 | } | 585 | } |
414 | 586 | ||
415 | /*protected void DebugPacket(string direction, Packet packet) | ||
416 | { | ||
417 | string info; | ||
418 | |||
419 | if (m_debugPacketLevel < 255 && packet.Type == PacketType.AgentUpdate) | ||
420 | return; | ||
421 | if (m_debugPacketLevel < 254 && packet.Type == PacketType.ViewerEffect) | ||
422 | return; | ||
423 | if (m_debugPacketLevel < 253 && ( | ||
424 | packet.Type == PacketType.CompletePingCheck || | ||
425 | packet.Type == PacketType.StartPingCheck | ||
426 | )) | ||
427 | return; | ||
428 | if (m_debugPacketLevel < 252 && packet.Type == PacketType.PacketAck) | ||
429 | return; | ||
430 | |||
431 | if (m_debugPacketLevel > 1) | ||
432 | { | ||
433 | info = packet.ToString(); | ||
434 | } | ||
435 | else | ||
436 | { | ||
437 | info = packet.Type.ToString(); | ||
438 | } | ||
439 | |||
440 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); | ||
441 | }*/ | ||
442 | |||
443 | #endregion Packet Handling | 587 | #endregion Packet Handling |
444 | 588 | ||
445 | # region Setup | 589 | # region Setup |
446 | 590 | ||
447 | /// <summary> | 591 | public virtual void Start() |
448 | /// Starts up the timers to check the client and resend unacked packets | ||
449 | /// Adds the client to the OpenSim.Region.Framework.Scenes.Scene | ||
450 | /// </summary> | ||
451 | protected virtual void InitNewClient() | ||
452 | { | 592 | { |
453 | m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); | 593 | m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); |
454 | m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); | 594 | m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); |
@@ -467,262 +607,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
467 | RefreshGroupMembership(); | 607 | RefreshGroupMembership(); |
468 | } | 608 | } |
469 | 609 | ||
470 | public virtual void Start() | ||
471 | { | ||
472 | // This sets up all the timers | ||
473 | InitNewClient(); | ||
474 | } | ||
475 | |||
476 | /// <summary> | ||
477 | /// Run a user session. This method lies at the base of the entire client thread. | ||
478 | /// </summary> | ||
479 | protected void RunUserSession() | ||
480 | { | ||
481 | try | ||
482 | { | ||
483 | |||
484 | } | ||
485 | catch (Exception e) | ||
486 | { | ||
487 | if (e is ThreadAbortException) | ||
488 | throw; | ||
489 | |||
490 | if (StatsManager.SimExtraStats != null) | ||
491 | StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); | ||
492 | |||
493 | // Don't let a failure in an individual client thread crash the whole sim. | ||
494 | m_log.ErrorFormat( | ||
495 | "[CLIENT]: Client thread for {0} {1} crashed. Logging them out.", Name, AgentId); | ||
496 | m_log.Error(e.ToString()); | ||
497 | |||
498 | try | ||
499 | { | ||
500 | // Make an attempt to alert the user that their session has crashed | ||
501 | AgentAlertMessagePacket packet | ||
502 | = BuildAgentAlertPacket( | ||
503 | "Unfortunately the session for this client on the server has crashed.\n" | ||
504 | + "Any further actions taken will not be processed.\n" | ||
505 | + "Please relog", true); | ||
506 | |||
507 | m_udpServer.SendPacket(m_agentId, packet, ThrottleOutPacketType.Unknown, false); | ||
508 | |||
509 | // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to | ||
510 | // listeners yet, though. | ||
511 | Logout(this); | ||
512 | } | ||
513 | catch (Exception e2) | ||
514 | { | ||
515 | if (e2 is ThreadAbortException) | ||
516 | throw; | ||
517 | |||
518 | m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2); | ||
519 | } | ||
520 | } | ||
521 | } | ||
522 | |||
523 | # endregion | 610 | # endregion |
524 | 611 | ||
525 | #region Events | ||
526 | |||
527 | public event GenericMessage OnGenericMessage; | ||
528 | public event BinaryGenericMessage OnBinaryGenericMessage; | ||
529 | public event Action<IClientAPI> OnLogout; | ||
530 | public event ObjectPermissions OnObjectPermissions; | ||
531 | public event Action<IClientAPI> OnConnectionClosed; | ||
532 | public event ViewerEffectEventHandler OnViewerEffect; | ||
533 | public event ImprovedInstantMessage OnInstantMessage; | ||
534 | public event ChatMessage OnChatFromClient; | ||
535 | public event TextureRequest OnRequestTexture; | ||
536 | public event RezObject OnRezObject; | ||
537 | public event DeRezObject OnDeRezObject; | ||
538 | public event ModifyTerrain OnModifyTerrain; | ||
539 | public event Action<IClientAPI> OnRegionHandShakeReply; | ||
540 | public event GenericCall2 OnRequestWearables; | ||
541 | public event SetAppearance OnSetAppearance; | ||
542 | public event AvatarNowWearing OnAvatarNowWearing; | ||
543 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | ||
544 | public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv; | ||
545 | public event UUIDNameRequest OnDetachAttachmentIntoInv; | ||
546 | public event ObjectAttach OnObjectAttach; | ||
547 | public event ObjectDeselect OnObjectDetach; | ||
548 | public event ObjectDrop OnObjectDrop; | ||
549 | public event GenericCall2 OnCompleteMovementToRegion; | ||
550 | public event UpdateAgent OnAgentUpdate; | ||
551 | public event AgentRequestSit OnAgentRequestSit; | ||
552 | public event AgentSit OnAgentSit; | ||
553 | public event AvatarPickerRequest OnAvatarPickerRequest; | ||
554 | public event StartAnim OnStartAnim; | ||
555 | public event StopAnim OnStopAnim; | ||
556 | public event Action<IClientAPI> OnRequestAvatarsData; | ||
557 | public event LinkObjects OnLinkObjects; | ||
558 | public event DelinkObjects OnDelinkObjects; | ||
559 | public event GrabObject OnGrabObject; | ||
560 | public event DeGrabObject OnDeGrabObject; | ||
561 | public event SpinStart OnSpinStart; | ||
562 | public event SpinStop OnSpinStop; | ||
563 | public event ObjectDuplicate OnObjectDuplicate; | ||
564 | public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; | ||
565 | public event MoveObject OnGrabUpdate; | ||
566 | public event SpinObject OnSpinUpdate; | ||
567 | public event AddNewPrim OnAddPrim; | ||
568 | public event RequestGodlikePowers OnRequestGodlikePowers; | ||
569 | public event GodKickUser OnGodKickUser; | ||
570 | public event ObjectExtraParams OnUpdateExtraParams; | ||
571 | public event UpdateShape OnUpdatePrimShape; | ||
572 | public event ObjectRequest OnObjectRequest; | ||
573 | public event ObjectSelect OnObjectSelect; | ||
574 | public event ObjectDeselect OnObjectDeselect; | ||
575 | public event GenericCall7 OnObjectDescription; | ||
576 | public event GenericCall7 OnObjectName; | ||
577 | public event GenericCall7 OnObjectClickAction; | ||
578 | public event GenericCall7 OnObjectMaterial; | ||
579 | public event ObjectIncludeInSearch OnObjectIncludeInSearch; | ||
580 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | ||
581 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
582 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
583 | public event UpdateVector OnUpdatePrimGroupPosition; | ||
584 | public event UpdateVector OnUpdatePrimSinglePosition; | ||
585 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | ||
586 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | ||
587 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; | ||
588 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; | ||
589 | public event UpdateVector OnUpdatePrimScale; | ||
590 | public event UpdateVector OnUpdatePrimGroupScale; | ||
591 | public event StatusChange OnChildAgentStatus; | ||
592 | public event GenericCall2 OnStopMovement; | ||
593 | public event Action<UUID> OnRemoveAvatar; | ||
594 | public event RequestMapBlocks OnRequestMapBlocks; | ||
595 | public event RequestMapName OnMapNameRequest; | ||
596 | public event TeleportLocationRequest OnTeleportLocationRequest; | ||
597 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest; | ||
598 | public event DisconnectUser OnDisconnectUser; | ||
599 | public event RequestAvatarProperties OnRequestAvatarProperties; | ||
600 | public event SetAlwaysRun OnSetAlwaysRun; | ||
601 | public event FetchInventory OnAgentDataUpdateRequest; | ||
602 | public event TeleportLocationRequest OnSetStartLocationRequest; | ||
603 | public event UpdateAvatarProperties OnUpdateAvatarProperties; | ||
604 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | ||
605 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | ||
606 | public event UpdateInventoryFolder OnUpdateInventoryFolder; | ||
607 | public event MoveInventoryFolder OnMoveInventoryFolder; | ||
608 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | ||
609 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; | ||
610 | public event FetchInventory OnFetchInventory; | ||
611 | public event RequestTaskInventory OnRequestTaskInventory; | ||
612 | public event UpdateInventoryItem OnUpdateInventoryItem; | ||
613 | public event CopyInventoryItem OnCopyInventoryItem; | ||
614 | public event MoveInventoryItem OnMoveInventoryItem; | ||
615 | public event RemoveInventoryItem OnRemoveInventoryItem; | ||
616 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | ||
617 | public event UDPAssetUploadRequest OnAssetUploadRequest; | ||
618 | public event XferReceive OnXferReceive; | ||
619 | public event RequestXfer OnRequestXfer; | ||
620 | public event ConfirmXfer OnConfirmXfer; | ||
621 | public event AbortXfer OnAbortXfer; | ||
622 | public event RequestTerrain OnRequestTerrain; | ||
623 | public event RezScript OnRezScript; | ||
624 | public event UpdateTaskInventory OnUpdateTaskInventory; | ||
625 | public event MoveTaskInventory OnMoveTaskItem; | ||
626 | public event RemoveTaskInventory OnRemoveTaskItem; | ||
627 | public event RequestAsset OnRequestAsset; | ||
628 | public event UUIDNameRequest OnNameFromUUIDRequest; | ||
629 | public event ParcelAccessListRequest OnParcelAccessListRequest; | ||
630 | public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; | ||
631 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
632 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
633 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
634 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
635 | public event ParcelSelectObjects OnParcelSelectObjects; | ||
636 | public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; | ||
637 | public event ParcelAbandonRequest OnParcelAbandonRequest; | ||
638 | public event ParcelGodForceOwner OnParcelGodForceOwner; | ||
639 | public event ParcelReclaim OnParcelReclaim; | ||
640 | public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest; | ||
641 | public event ParcelDeedToGroup OnParcelDeedToGroup; | ||
642 | public event RegionInfoRequest OnRegionInfoRequest; | ||
643 | public event EstateCovenantRequest OnEstateCovenantRequest; | ||
644 | public event FriendActionDelegate OnApproveFriendRequest; | ||
645 | public event FriendActionDelegate OnDenyFriendRequest; | ||
646 | public event FriendshipTermination OnTerminateFriendship; | ||
647 | public event MoneyTransferRequest OnMoneyTransferRequest; | ||
648 | public event EconomyDataRequest OnEconomyDataRequest; | ||
649 | public event MoneyBalanceRequest OnMoneyBalanceRequest; | ||
650 | public event ParcelBuy OnParcelBuy; | ||
651 | public event UUIDNameRequest OnTeleportHomeRequest; | ||
652 | public event UUIDNameRequest OnUUIDGroupNameRequest; | ||
653 | public event ScriptAnswer OnScriptAnswer; | ||
654 | public event RequestPayPrice OnRequestPayPrice; | ||
655 | public event ObjectSaleInfo OnObjectSaleInfo; | ||
656 | public event ObjectBuy OnObjectBuy; | ||
657 | public event BuyObjectInventory OnBuyObjectInventory; | ||
658 | public event AgentSit OnUndo; | ||
659 | public event ForceReleaseControls OnForceReleaseControls; | ||
660 | public event GodLandStatRequest OnLandStatRequest; | ||
661 | public event RequestObjectPropertiesFamily OnObjectGroupRequest; | ||
662 | public event DetailedEstateDataRequest OnDetailedEstateDataRequest; | ||
663 | public event SetEstateFlagsRequest OnSetEstateFlagsRequest; | ||
664 | public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture; | ||
665 | public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture; | ||
666 | public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights; | ||
667 | public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; | ||
668 | public event SetRegionTerrainSettings OnSetRegionTerrainSettings; | ||
669 | public event BakeTerrain OnBakeTerrain; | ||
670 | public event RequestTerrain OnUploadTerrain; | ||
671 | public event EstateChangeInfo OnEstateChangeInfo; | ||
672 | public event EstateRestartSimRequest OnEstateRestartSimRequest; | ||
673 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; | ||
674 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; | ||
675 | public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest; | ||
676 | public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest; | ||
677 | public event EstateDebugRegionRequest OnEstateDebugRegionRequest; | ||
678 | public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; | ||
679 | public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; | ||
680 | public event RegionHandleRequest OnRegionHandleRequest; | ||
681 | public event ParcelInfoRequest OnParcelInfoRequest; | ||
682 | public event ScriptReset OnScriptReset; | ||
683 | public event GetScriptRunning OnGetScriptRunning; | ||
684 | public event SetScriptRunning OnSetScriptRunning; | ||
685 | public event UpdateVector OnAutoPilotGo; | ||
686 | public event TerrainUnacked OnUnackedTerrain; | ||
687 | public event ActivateGesture OnActivateGesture; | ||
688 | public event DeactivateGesture OnDeactivateGesture; | ||
689 | public event ObjectOwner OnObjectOwner; | ||
690 | public event DirPlacesQuery OnDirPlacesQuery; | ||
691 | public event DirFindQuery OnDirFindQuery; | ||
692 | public event DirLandQuery OnDirLandQuery; | ||
693 | public event DirPopularQuery OnDirPopularQuery; | ||
694 | public event DirClassifiedQuery OnDirClassifiedQuery; | ||
695 | public event EventInfoRequest OnEventInfoRequest; | ||
696 | public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime; | ||
697 | public event MapItemRequest OnMapItemRequest; | ||
698 | public event OfferCallingCard OnOfferCallingCard; | ||
699 | public event AcceptCallingCard OnAcceptCallingCard; | ||
700 | public event DeclineCallingCard OnDeclineCallingCard; | ||
701 | public event SoundTrigger OnSoundTrigger; | ||
702 | public event StartLure OnStartLure; | ||
703 | public event TeleportLureRequest OnTeleportLureRequest; | ||
704 | public event NetworkStats OnNetworkStatsUpdate; | ||
705 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | ||
706 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | ||
707 | public event ClassifiedDelete OnClassifiedDelete; | ||
708 | public event ClassifiedDelete OnClassifiedGodDelete; | ||
709 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | ||
710 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | ||
711 | public event EventGodDelete OnEventGodDelete; | ||
712 | public event ParcelDwellRequest OnParcelDwellRequest; | ||
713 | public event UserInfoRequest OnUserInfoRequest; | ||
714 | public event UpdateUserInfo OnUpdateUserInfo; | ||
715 | public event RetrieveInstantMessages OnRetrieveInstantMessages; | ||
716 | public event PickDelete OnPickDelete; | ||
717 | public event PickGodDelete OnPickGodDelete; | ||
718 | public event PickInfoUpdate OnPickInfoUpdate; | ||
719 | public event AvatarNotesUpdate OnAvatarNotesUpdate; | ||
720 | public event MuteListRequest OnMuteListRequest; | ||
721 | public event AvatarInterestUpdate OnAvatarInterestUpdate; | ||
722 | public event PlacesQuery OnPlacesQuery; | ||
723 | |||
724 | #endregion Events | ||
725 | |||
726 | public void ActivateGesture(UUID assetId, UUID gestureId) | 612 | public void ActivateGesture(UUID assetId, UUID gestureId) |
727 | { | 613 | { |
728 | } | 614 | } |
@@ -1342,7 +1228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1342 | kill.ObjectData[0].ID = localID; | 1228 | kill.ObjectData[0].ID = localID; |
1343 | kill.Header.Reliable = true; | 1229 | kill.Header.Reliable = true; |
1344 | kill.Header.Zerocoded = true; | 1230 | kill.Header.Zerocoded = true; |
1345 | OutPacket(kill, ThrottleOutPacketType.Task); | 1231 | OutPacket(kill, ThrottleOutPacketType.State); |
1346 | } | 1232 | } |
1347 | 1233 | ||
1348 | /// <summary> | 1234 | /// <summary> |
@@ -1936,7 +1822,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1936 | sendXfer.XferID.ID = xferID; | 1822 | sendXfer.XferID.ID = xferID; |
1937 | sendXfer.XferID.Packet = packet; | 1823 | sendXfer.XferID.Packet = packet; |
1938 | sendXfer.DataPacket.Data = data; | 1824 | sendXfer.DataPacket.Data = data; |
1939 | OutPacket(sendXfer, ThrottleOutPacketType.Task); | 1825 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); |
1940 | } | 1826 | } |
1941 | 1827 | ||
1942 | public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, | 1828 | public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, |
@@ -2218,7 +2104,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2218 | packet.AgentData.SessionID = SessionId; | 2104 | packet.AgentData.SessionID = SessionId; |
2219 | packet.Header.Reliable = false; | 2105 | packet.Header.Reliable = false; |
2220 | packet.Header.Zerocoded = true; | 2106 | packet.Header.Zerocoded = true; |
2221 | OutPacket(packet, ThrottleOutPacketType.Task); | 2107 | OutPacket(packet, ThrottleOutPacketType.State); |
2222 | } | 2108 | } |
2223 | 2109 | ||
2224 | public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, | 2110 | public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, |
@@ -3241,7 +3127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3241 | 3127 | ||
3242 | avp.Sender.IsTrial = false; | 3128 | avp.Sender.IsTrial = false; |
3243 | avp.Sender.ID = agentID; | 3129 | avp.Sender.ID = agentID; |
3244 | OutPacket(avp, ThrottleOutPacketType.Task); | 3130 | OutPacket(avp, ThrottleOutPacketType.State); |
3245 | } | 3131 | } |
3246 | 3132 | ||
3247 | public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) | 3133 | public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) |
@@ -3366,7 +3252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3366 | int length = 0; | 3252 | int length = 0; |
3367 | m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length); | 3253 | m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length); |
3368 | length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); | 3254 | length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); |
3369 | if (size + length > m_packetMTU) | 3255 | if (size + length > Packet.MTU) |
3370 | break; | 3256 | break; |
3371 | size += length; | 3257 | size += length; |
3372 | } | 3258 | } |
@@ -3381,6 +3267,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3381 | 3267 | ||
3382 | terse.Header.Reliable = false; | 3268 | terse.Header.Reliable = false; |
3383 | terse.Header.Zerocoded = true; | 3269 | terse.Header.Zerocoded = true; |
3270 | // FIXME: Move this to ThrottleOutPacketType.State when the real prioritization code is committed | ||
3384 | OutPacket(terse, ThrottleOutPacketType.Task); | 3271 | OutPacket(terse, ThrottleOutPacketType.Task); |
3385 | 3272 | ||
3386 | if (m_avatarTerseUpdates.Count == 0) | 3273 | if (m_avatarTerseUpdates.Count == 0) |
@@ -3571,7 +3458,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3571 | void ProcessTextureRequests() | 3458 | void ProcessTextureRequests() |
3572 | { | 3459 | { |
3573 | if (m_imageManager != null) | 3460 | if (m_imageManager != null) |
3574 | m_imageManager.ProcessImageQueue(m_textureSendLimit, m_textureDataLimit); | 3461 | m_imageManager.ProcessImageQueue(m_textureSendLimit); |
3575 | } | 3462 | } |
3576 | 3463 | ||
3577 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) | 3464 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) |
@@ -3610,7 +3497,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3610 | int length = 0; | 3497 | int length = 0; |
3611 | m_primFullUpdates[count].ToBytes(blockbuffer, ref length); | 3498 | m_primFullUpdates[count].ToBytes(blockbuffer, ref length); |
3612 | length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); | 3499 | length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); |
3613 | if (size + length > m_packetMTU) | 3500 | if (size + length > Packet.MTU) |
3614 | break; | 3501 | break; |
3615 | size += length; | 3502 | size += length; |
3616 | } | 3503 | } |
@@ -3625,7 +3512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3625 | } | 3512 | } |
3626 | 3513 | ||
3627 | outPacket.Header.Zerocoded = true; | 3514 | outPacket.Header.Zerocoded = true; |
3628 | OutPacket(outPacket, ThrottleOutPacketType.Task); | 3515 | OutPacket(outPacket, ThrottleOutPacketType.State); |
3629 | 3516 | ||
3630 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3517 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3631 | lock (m_primFullUpdateTimer) | 3518 | lock (m_primFullUpdateTimer) |
@@ -3698,7 +3585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3698 | int length = 0; | 3585 | int length = 0; |
3699 | m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); | 3586 | m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); |
3700 | length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); | 3587 | length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); |
3701 | if (size + length > m_packetMTU) | 3588 | if (size + length > Packet.MTU) |
3702 | break; | 3589 | break; |
3703 | size += length; | 3590 | size += length; |
3704 | } | 3591 | } |
@@ -3715,7 +3602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3715 | 3602 | ||
3716 | outPacket.Header.Reliable = false; | 3603 | outPacket.Header.Reliable = false; |
3717 | outPacket.Header.Zerocoded = true; | 3604 | outPacket.Header.Zerocoded = true; |
3718 | OutPacket(outPacket, ThrottleOutPacketType.Task); | 3605 | OutPacket(outPacket, ThrottleOutPacketType.State); |
3719 | 3606 | ||
3720 | if (m_primTerseUpdates.Count == 0) | 3607 | if (m_primTerseUpdates.Count == 0) |
3721 | lock (m_primTerseUpdateTimer) | 3608 | lock (m_primTerseUpdateTimer) |
@@ -4801,7 +4688,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4801 | 4688 | ||
4802 | public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) | 4689 | public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) |
4803 | { | 4690 | { |
4804 | |||
4805 | ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack; | 4691 | ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack; |
4806 | if (ogpack.AgentData.SessionID != SessionId) return false; | 4692 | if (ogpack.AgentData.SessionID != SessionId) return false; |
4807 | 4693 | ||
@@ -7013,7 +6899,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7013 | #endregion | 6899 | #endregion |
7014 | 6900 | ||
7015 | //handlerTextureRequest = null; | 6901 | //handlerTextureRequest = null; |
7016 | |||
7017 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | 6902 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) |
7018 | { | 6903 | { |
7019 | if (OnRequestTexture != null) | 6904 | if (OnRequestTexture != null) |
@@ -7024,7 +6909,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7024 | args.PacketNumber = imageRequest.RequestImage[i].Packet; | 6909 | args.PacketNumber = imageRequest.RequestImage[i].Packet; |
7025 | args.Priority = imageRequest.RequestImage[i].DownloadPriority; | 6910 | args.Priority = imageRequest.RequestImage[i].DownloadPriority; |
7026 | args.requestSequence = imageRequest.Header.Sequence; | 6911 | args.requestSequence = imageRequest.Header.Sequence; |
7027 | |||
7028 | //handlerTextureRequest = OnRequestTexture; | 6912 | //handlerTextureRequest = OnRequestTexture; |
7029 | 6913 | ||
7030 | //if (handlerTextureRequest != null) | 6914 | //if (handlerTextureRequest != null) |
@@ -7047,10 +6931,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7047 | // Validate inventory transfers | 6931 | // Validate inventory transfers |
7048 | // Has to be done here, because AssetCache can't do it | 6932 | // Has to be done here, because AssetCache can't do it |
7049 | // | 6933 | // |
7050 | 6934 | UUID taskID = UUID.Zero; | |
7051 | if (transfer.TransferInfo.SourceType == 3) | 6935 | if (transfer.TransferInfo.SourceType == 3) |
7052 | { | 6936 | { |
7053 | UUID taskID = new UUID(transfer.TransferInfo.Params, 48); | 6937 | taskID = new UUID(transfer.TransferInfo.Params, 48); |
7054 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); | 6938 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); |
7055 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); | 6939 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); |
7056 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) | 6940 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) |
@@ -7121,7 +7005,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7121 | 7005 | ||
7122 | //m_assetCache.AddAssetRequest(this, transfer); | 7006 | //m_assetCache.AddAssetRequest(this, transfer); |
7123 | 7007 | ||
7124 | MakeAssetRequest(transfer); | 7008 | MakeAssetRequest(transfer, taskID); |
7125 | 7009 | ||
7126 | /* RequestAsset = OnRequestAsset; | 7010 | /* RequestAsset = OnRequestAsset; |
7127 | if (RequestAsset != null) | 7011 | if (RequestAsset != null) |
@@ -10250,7 +10134,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10250 | 10134 | ||
10251 | public void KillEndDone() | 10135 | public void KillEndDone() |
10252 | { | 10136 | { |
10253 | m_udpClient.Shutdown(); | ||
10254 | } | 10137 | } |
10255 | 10138 | ||
10256 | #region IClientCore | 10139 | #region IClientCore |
@@ -10293,15 +10176,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10293 | { | 10176 | { |
10294 | Kick(reason); | 10177 | Kick(reason); |
10295 | Thread.Sleep(1000); | 10178 | Thread.Sleep(1000); |
10296 | Close(true); | 10179 | Close(); |
10297 | } | 10180 | } |
10298 | 10181 | ||
10299 | public void Disconnect() | 10182 | public void Disconnect() |
10300 | { | 10183 | { |
10301 | Close(true); | 10184 | Close(); |
10302 | } | 10185 | } |
10303 | 10186 | ||
10304 | |||
10305 | #endregion | 10187 | #endregion |
10306 | 10188 | ||
10307 | public void RefreshGroupMembership() | 10189 | public void RefreshGroupMembership() |
@@ -10330,7 +10212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10330 | return String.Empty; | 10212 | return String.Empty; |
10331 | } | 10213 | } |
10332 | 10214 | ||
10333 | public void MakeAssetRequest(TransferRequestPacket transferRequest) | 10215 | public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) |
10334 | { | 10216 | { |
10335 | UUID requestID = UUID.Zero; | 10217 | UUID requestID = UUID.Zero; |
10336 | if (transferRequest.TransferInfo.SourceType == 2) | 10218 | if (transferRequest.TransferInfo.SourceType == 2) |
@@ -10342,12 +10224,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10342 | { | 10224 | { |
10343 | //inventory asset request | 10225 | //inventory asset request |
10344 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); | 10226 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); |
10345 | //m_log.Debug("asset request " + requestID); | 10227 | //m_log.Debug("[XXX] inventory asset request " + requestID); |
10228 | //if (taskID == UUID.Zero) // Agent | ||
10229 | // if (m_scene is HGScene) | ||
10230 | // { | ||
10231 | // m_log.Debug("[XXX] hg asset request " + requestID); | ||
10232 | // // We may need to fetch the asset from the user's asset server into the local asset server | ||
10233 | // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper; | ||
10234 | // mapper.Get(requestID, AgentId); | ||
10235 | // } | ||
10346 | } | 10236 | } |
10347 | 10237 | ||
10348 | //check to see if asset is in local cache, if not we need to request it from asset server. | 10238 | //check to see if asset is in local cache, if not we need to request it from asset server. |
10349 | //m_log.Debug("asset request " + requestID); | 10239 | //m_log.Debug("asset request " + requestID); |
10350 | 10240 | ||
10351 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 10241 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
10352 | 10242 | ||
10353 | } | 10243 | } |
@@ -10358,12 +10248,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10358 | 10248 | ||
10359 | UUID requestID = UUID.Zero; | 10249 | UUID requestID = UUID.Zero; |
10360 | byte source = 2; | 10250 | byte source = 2; |
10361 | if (transferRequest.TransferInfo.SourceType == 2) | 10251 | if ((transferRequest.TransferInfo.SourceType == 2) || (transferRequest.TransferInfo.SourceType == 2222)) |
10362 | { | 10252 | { |
10363 | //direct asset request | 10253 | //direct asset request |
10364 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); | 10254 | requestID = new UUID(transferRequest.TransferInfo.Params, 0); |
10365 | } | 10255 | } |
10366 | else if (transferRequest.TransferInfo.SourceType == 3) | 10256 | else if ((transferRequest.TransferInfo.SourceType == 3) || (transferRequest.TransferInfo.SourceType == 3333)) |
10367 | { | 10257 | { |
10368 | //inventory asset request | 10258 | //inventory asset request |
10369 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); | 10259 | requestID = new UUID(transferRequest.TransferInfo.Params, 80); |
@@ -10371,10 +10261,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10371 | //m_log.Debug("asset request " + requestID); | 10261 | //m_log.Debug("asset request " + requestID); |
10372 | } | 10262 | } |
10373 | 10263 | ||
10374 | // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. | ||
10375 | if (null == asset) | 10264 | if (null == asset) |
10376 | { | 10265 | { |
10266 | if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000)) | ||
10267 | { | ||
10268 | // Try the user's inventory, but only if it's different from the regions' | ||
10269 | string userAssets = m_hyperAssets.GetUserAssetServer(AgentId); | ||
10270 | if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) | ||
10271 | { | ||
10272 | m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); | ||
10273 | if (transferRequest.TransferInfo.SourceType == 2) | ||
10274 | transferRequest.TransferInfo.SourceType = 2222; // marker | ||
10275 | else if (transferRequest.TransferInfo.SourceType == 3) | ||
10276 | transferRequest.TransferInfo.SourceType = 3333; // marker | ||
10277 | |||
10278 | m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); | ||
10279 | return; | ||
10280 | } | ||
10281 | } | ||
10282 | |||
10377 | //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); | 10283 | //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); |
10284 | |||
10285 | // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. | ||
10378 | return; | 10286 | return; |
10379 | } | 10287 | } |
10380 | 10288 | ||