aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/ClientManager.cs163
-rw-r--r--OpenSim/Framework/IScene.cs1
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs442
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs5
8 files changed, 262 insertions, 410 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 094a3ff..5ebbbc1 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -34,120 +34,33 @@ using OpenMetaverse.Packets;
34 34
35namespace OpenSim.Framework 35namespace OpenSim.Framework
36{ 36{
37 public delegate void ForEachClientDelegate(IClientAPI client);
38
39 public class ClientManager 37 public class ClientManager
40 { 38 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 40
43 private Dictionary<uint, IClientAPI> m_clients; 41 private Dictionary<uint, IClientAPI> m_clients = new Dictionary<uint, IClientAPI>();
44
45 public ClientManager()
46 {
47 m_clients = new Dictionary<uint, IClientAPI>();
48 }
49 42
50 public void ForEachClient(ForEachClientDelegate whatToDo) 43 public void Add(uint circuitCode, IClientAPI client)
51 { 44 {
52 IClientAPI[] LocalClients;
53 lock (m_clients) 45 lock (m_clients)
54 { 46 m_clients.Add(circuitCode, client);
55 LocalClients = new IClientAPI[m_clients.Count];
56 m_clients.Values.CopyTo(LocalClients, 0);
57 }
58
59 for (int i = 0; i < LocalClients.Length; i++)
60 {
61 try
62 {
63 whatToDo(LocalClients[i]);
64 }
65 catch (Exception e)
66 {
67 m_log.Warn("[CLIENT]: Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString());
68 }
69 }
70 } 47 }
71 48
72 public void Remove(uint id) 49 public bool Remove(uint circuitCode)
73 { 50 {
74 lock (m_clients) 51 lock (m_clients)
75 { 52 return m_clients.Remove(circuitCode);
76 m_clients.Remove(id);
77 }
78 }
79
80 public void Add(uint id, IClientAPI client)
81 {
82 lock (m_clients)
83 {
84 m_clients.Add(id, client);
85 }
86 }
87
88 /// <summary>
89 /// Pass incoming packet to client.
90 /// </summary>
91 /// <param name="circuitCode">uint identifying the connection/client.</param>
92 /// <param name="packet">object containing the packet.</param>
93 public void InPacket(uint circuitCode, object packet)
94 {
95 IClientAPI client;
96 bool tryGetRet = false;
97
98 lock (m_clients)
99 tryGetRet = m_clients.TryGetValue(circuitCode, out client);
100
101 if (tryGetRet)
102 {
103 client.InPacket(packet);
104 }
105 } 53 }
106 54
107 public void CloseAllAgents(uint circuitCode) 55 public bool TryGetClient(uint circuitCode, out IClientAPI user)
108 { 56 {
109 IClientAPI client;
110 bool tryGetRet = false;
111 lock (m_clients) 57 lock (m_clients)
112 tryGetRet = m_clients.TryGetValue(circuitCode, out client); 58 return m_clients.TryGetValue(circuitCode, out user);
113 if (tryGetRet)
114 {
115 CloseAllCircuits(client.AgentId);
116 }
117 }
118
119 public void CloseAllCircuits(UUID agentId)
120 {
121 uint[] circuits = GetAllCircuits(agentId);
122 // We're using a for loop here so changes to the circuits don't cause it to completely fail.
123
124 for (int i = 0; i < circuits.Length; i++)
125 {
126 IClientAPI client;
127 try
128 {
129 bool tryGetRet = false;
130 lock (m_clients)
131 tryGetRet = m_clients.TryGetValue(circuits[i], out client);
132 if (tryGetRet)
133 {
134 Remove(client.CircuitCode);
135 client.Close(false);
136 }
137 }
138 catch (Exception e)
139 {
140 m_log.Error(string.Format("[CLIENT]: Unable to shutdown circuit for: {0}\n Reason: {1}", agentId, e));
141 }
142 }
143 } 59 }
144 60
145 // [Obsolete("Using Obsolete to drive development is invalid. Obsolete presumes that something new has already been created to replace this.")] 61 public void ForEachClient(Action<IClientAPI> action)
146 public uint[] GetAllCircuits(UUID agentId)
147 { 62 {
148 List<uint> circuits = new List<uint>(); 63 IClientAPI[] LocalClients;
149 // Wasteful, I know
150 IClientAPI[] LocalClients = new IClientAPI[0];
151 lock (m_clients) 64 lock (m_clients)
152 { 65 {
153 LocalClients = new IClientAPI[m_clients.Count]; 66 LocalClients = new IClientAPI[m_clients.Count];
@@ -156,65 +69,15 @@ namespace OpenSim.Framework
156 69
157 for (int i = 0; i < LocalClients.Length; i++) 70 for (int i = 0; i < LocalClients.Length; i++)
158 { 71 {
159 if (LocalClients[i].AgentId == agentId) 72 try
160 { 73 {
161 circuits.Add(LocalClients[i].CircuitCode); 74 action(LocalClients[i]);
162 } 75 }
163 } 76 catch (Exception e)
164 return circuits.ToArray();
165 }
166
167 public List<uint> GetAllCircuitCodes()
168 {
169 List<uint> circuits;
170
171 lock (m_clients)
172 {
173 circuits = new List<uint>(m_clients.Keys);
174 }
175
176 return circuits;
177 }
178
179 public void ViewerEffectHandler(IClientAPI sender, List<ViewerEffectEventHandlerArg> args)
180 {
181 // TODO: don't create new blocks if recycling an old packet
182 List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
183 for (int i = 0; i < args.Count; i++)
184 {
185 ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
186 effect.AgentID = args[i].AgentID;
187 effect.Color = args[i].Color;
188 effect.Duration = args[i].Duration;
189 effect.ID = args[i].ID;
190 effect.Type = args[i].Type;
191 effect.TypeData = args[i].TypeData;
192 effectBlock.Add(effect);
193 }
194 ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
195
196 IClientAPI[] LocalClients;
197 lock (m_clients)
198 {
199 LocalClients = new IClientAPI[m_clients.Count];
200 m_clients.Values.CopyTo(LocalClients, 0);
201 }
202
203 for (int i = 0; i < LocalClients.Length; i++)
204 {
205 if (LocalClients[i].AgentId != sender.AgentId)
206 { 77 {
207 LocalClients[i].SendViewerEffect(effectBlockArray); 78 m_log.Warn("[CLIENT]: Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString());
208 } 79 }
209 } 80 }
210 } 81 }
211
212 public bool TryGetClient(uint circuitId, out IClientAPI user)
213 {
214 lock (m_clients)
215 {
216 return m_clients.TryGetValue(circuitId, out user);
217 }
218 }
219 } 82 }
220} 83}
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 489653f..f34027d 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -71,7 +71,6 @@ namespace OpenSim.Framework
71 71
72 void AddNewClient(IClientAPI client); 72 void AddNewClient(IClientAPI client);
73 void RemoveClient(UUID agentID); 73 void RemoveClient(UUID agentID);
74 void CloseAllAgents(uint circuitcode);
75 74
76 void Restart(int seconds); 75 void Restart(int seconds);
77 //RegionInfo OtherRegionUp(RegionInfo thisRegion); 76 //RegionInfo OtherRegionUp(RegionInfo thisRegion);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 139dc3b..bc9cfcf 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -58,6 +58,209 @@ namespace OpenSim.Region.ClientStack.LindenUDP
58 /// </summary> 58 /// </summary>
59 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector 59 public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
60 { 60 {
61 #region Events
62
63 public event GenericMessage OnGenericMessage;
64 public event BinaryGenericMessage OnBinaryGenericMessage;
65 public event Action<IClientAPI> OnLogout;
66 public event ObjectPermissions OnObjectPermissions;
67 public event Action<IClientAPI> OnConnectionClosed;
68 public event ViewerEffectEventHandler OnViewerEffect;
69 public event ImprovedInstantMessage OnInstantMessage;
70 public event ChatMessage OnChatFromClient;
71 public event TextureRequest OnRequestTexture;
72 public event RezObject OnRezObject;
73 public event DeRezObject OnDeRezObject;
74 public event ModifyTerrain OnModifyTerrain;
75 public event Action<IClientAPI> OnRegionHandShakeReply;
76 public event GenericCall2 OnRequestWearables;
77 public event SetAppearance OnSetAppearance;
78 public event AvatarNowWearing OnAvatarNowWearing;
79 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
80 public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
81 public event UUIDNameRequest OnDetachAttachmentIntoInv;
82 public event ObjectAttach OnObjectAttach;
83 public event ObjectDeselect OnObjectDetach;
84 public event ObjectDrop OnObjectDrop;
85 public event GenericCall2 OnCompleteMovementToRegion;
86 public event UpdateAgent OnAgentUpdate;
87 public event AgentRequestSit OnAgentRequestSit;
88 public event AgentSit OnAgentSit;
89 public event AvatarPickerRequest OnAvatarPickerRequest;
90 public event StartAnim OnStartAnim;
91 public event StopAnim OnStopAnim;
92 public event Action<IClientAPI> OnRequestAvatarsData;
93 public event LinkObjects OnLinkObjects;
94 public event DelinkObjects OnDelinkObjects;
95 public event GrabObject OnGrabObject;
96 public event DeGrabObject OnDeGrabObject;
97 public event SpinStart OnSpinStart;
98 public event SpinStop OnSpinStop;
99 public event ObjectDuplicate OnObjectDuplicate;
100 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
101 public event MoveObject OnGrabUpdate;
102 public event SpinObject OnSpinUpdate;
103 public event AddNewPrim OnAddPrim;
104 public event RequestGodlikePowers OnRequestGodlikePowers;
105 public event GodKickUser OnGodKickUser;
106 public event ObjectExtraParams OnUpdateExtraParams;
107 public event UpdateShape OnUpdatePrimShape;
108 public event ObjectRequest OnObjectRequest;
109 public event ObjectSelect OnObjectSelect;
110 public event ObjectDeselect OnObjectDeselect;
111 public event GenericCall7 OnObjectDescription;
112 public event GenericCall7 OnObjectName;
113 public event GenericCall7 OnObjectClickAction;
114 public event GenericCall7 OnObjectMaterial;
115 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
116 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
117 public event UpdatePrimFlags OnUpdatePrimFlags;
118 public event UpdatePrimTexture OnUpdatePrimTexture;
119 public event UpdateVector OnUpdatePrimGroupPosition;
120 public event UpdateVector OnUpdatePrimSinglePosition;
121 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
122 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
123 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
124 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
125 public event UpdateVector OnUpdatePrimScale;
126 public event UpdateVector OnUpdatePrimGroupScale;
127 public event StatusChange OnChildAgentStatus;
128 public event GenericCall2 OnStopMovement;
129 public event Action<UUID> OnRemoveAvatar;
130 public event RequestMapBlocks OnRequestMapBlocks;
131 public event RequestMapName OnMapNameRequest;
132 public event TeleportLocationRequest OnTeleportLocationRequest;
133 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
134 public event DisconnectUser OnDisconnectUser;
135 public event RequestAvatarProperties OnRequestAvatarProperties;
136 public event SetAlwaysRun OnSetAlwaysRun;
137 public event FetchInventory OnAgentDataUpdateRequest;
138 public event TeleportLocationRequest OnSetStartLocationRequest;
139 public event UpdateAvatarProperties OnUpdateAvatarProperties;
140 public event CreateNewInventoryItem OnCreateNewInventoryItem;
141 public event CreateInventoryFolder OnCreateNewInventoryFolder;
142 public event UpdateInventoryFolder OnUpdateInventoryFolder;
143 public event MoveInventoryFolder OnMoveInventoryFolder;
144 public event FetchInventoryDescendents OnFetchInventoryDescendents;
145 public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
146 public event FetchInventory OnFetchInventory;
147 public event RequestTaskInventory OnRequestTaskInventory;
148 public event UpdateInventoryItem OnUpdateInventoryItem;
149 public event CopyInventoryItem OnCopyInventoryItem;
150 public event MoveInventoryItem OnMoveInventoryItem;
151 public event RemoveInventoryItem OnRemoveInventoryItem;
152 public event RemoveInventoryFolder OnRemoveInventoryFolder;
153 public event UDPAssetUploadRequest OnAssetUploadRequest;
154 public event XferReceive OnXferReceive;
155 public event RequestXfer OnRequestXfer;
156 public event ConfirmXfer OnConfirmXfer;
157 public event AbortXfer OnAbortXfer;
158 public event RequestTerrain OnRequestTerrain;
159 public event RezScript OnRezScript;
160 public event UpdateTaskInventory OnUpdateTaskInventory;
161 public event MoveTaskInventory OnMoveTaskItem;
162 public event RemoveTaskInventory OnRemoveTaskItem;
163 public event RequestAsset OnRequestAsset;
164 public event UUIDNameRequest OnNameFromUUIDRequest;
165 public event ParcelAccessListRequest OnParcelAccessListRequest;
166 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
167 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
168 public event ParcelDivideRequest OnParcelDivideRequest;
169 public event ParcelJoinRequest OnParcelJoinRequest;
170 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
171 public event ParcelSelectObjects OnParcelSelectObjects;
172 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
173 public event ParcelAbandonRequest OnParcelAbandonRequest;
174 public event ParcelGodForceOwner OnParcelGodForceOwner;
175 public event ParcelReclaim OnParcelReclaim;
176 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
177 public event ParcelDeedToGroup OnParcelDeedToGroup;
178 public event RegionInfoRequest OnRegionInfoRequest;
179 public event EstateCovenantRequest OnEstateCovenantRequest;
180 public event FriendActionDelegate OnApproveFriendRequest;
181 public event FriendActionDelegate OnDenyFriendRequest;
182 public event FriendshipTermination OnTerminateFriendship;
183 public event MoneyTransferRequest OnMoneyTransferRequest;
184 public event EconomyDataRequest OnEconomyDataRequest;
185 public event MoneyBalanceRequest OnMoneyBalanceRequest;
186 public event ParcelBuy OnParcelBuy;
187 public event UUIDNameRequest OnTeleportHomeRequest;
188 public event UUIDNameRequest OnUUIDGroupNameRequest;
189 public event ScriptAnswer OnScriptAnswer;
190 public event RequestPayPrice OnRequestPayPrice;
191 public event ObjectSaleInfo OnObjectSaleInfo;
192 public event ObjectBuy OnObjectBuy;
193 public event BuyObjectInventory OnBuyObjectInventory;
194 public event AgentSit OnUndo;
195 public event ForceReleaseControls OnForceReleaseControls;
196 public event GodLandStatRequest OnLandStatRequest;
197 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
198 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
199 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
200 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
201 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
202 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
203 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
204 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
205 public event BakeTerrain OnBakeTerrain;
206 public event RequestTerrain OnUploadTerrain;
207 public event EstateChangeInfo OnEstateChangeInfo;
208 public event EstateRestartSimRequest OnEstateRestartSimRequest;
209 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
210 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
211 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
212 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
213 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
214 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
215 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
216 public event RegionHandleRequest OnRegionHandleRequest;
217 public event ParcelInfoRequest OnParcelInfoRequest;
218 public event ScriptReset OnScriptReset;
219 public event GetScriptRunning OnGetScriptRunning;
220 public event SetScriptRunning OnSetScriptRunning;
221 public event UpdateVector OnAutoPilotGo;
222 public event TerrainUnacked OnUnackedTerrain;
223 public event ActivateGesture OnActivateGesture;
224 public event DeactivateGesture OnDeactivateGesture;
225 public event ObjectOwner OnObjectOwner;
226 public event DirPlacesQuery OnDirPlacesQuery;
227 public event DirFindQuery OnDirFindQuery;
228 public event DirLandQuery OnDirLandQuery;
229 public event DirPopularQuery OnDirPopularQuery;
230 public event DirClassifiedQuery OnDirClassifiedQuery;
231 public event EventInfoRequest OnEventInfoRequest;
232 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
233 public event MapItemRequest OnMapItemRequest;
234 public event OfferCallingCard OnOfferCallingCard;
235 public event AcceptCallingCard OnAcceptCallingCard;
236 public event DeclineCallingCard OnDeclineCallingCard;
237 public event SoundTrigger OnSoundTrigger;
238 public event StartLure OnStartLure;
239 public event TeleportLureRequest OnTeleportLureRequest;
240 public event NetworkStats OnNetworkStatsUpdate;
241 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
242 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
243 public event ClassifiedDelete OnClassifiedDelete;
244 public event ClassifiedDelete OnClassifiedGodDelete;
245 public event EventNotificationAddRequest OnEventNotificationAddRequest;
246 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
247 public event EventGodDelete OnEventGodDelete;
248 public event ParcelDwellRequest OnParcelDwellRequest;
249 public event UserInfoRequest OnUserInfoRequest;
250 public event UpdateUserInfo OnUpdateUserInfo;
251 public event RetrieveInstantMessages OnRetrieveInstantMessages;
252 public event PickDelete OnPickDelete;
253 public event PickGodDelete OnPickGodDelete;
254 public event PickInfoUpdate OnPickInfoUpdate;
255 public event AvatarNotesUpdate OnAvatarNotesUpdate;
256 public event MuteListRequest OnMuteListRequest;
257 public event AvatarInterestUpdate OnAvatarInterestUpdate;
258 public event PlacesQuery OnPlacesQuery;
259
260 #endregion Events
261
262 #region Class Members
263
61 // LLClientView Only 264 // LLClientView Only
62 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args); 265 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
63 266
@@ -114,9 +317,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
114 protected int m_textureDataLimit = 10; 317 protected int m_textureDataLimit = 10;
115 protected int m_avatarTerseUpdateRate = 50; 318 protected int m_avatarTerseUpdateRate = 50;
116 protected int m_avatarTerseUpdatesPerPacket = 5; 319 protected int m_avatarTerseUpdatesPerPacket = 5;
117 protected int m_packetMTU = 1400;
118 protected IAssetService m_assetService; 320 protected IAssetService m_assetService;
119 321
322 #endregion Class Members
323
120 #region Properties 324 #region Properties
121 325
122 public LLUDPClient UDPClient { get { return m_udpClient; } } 326 public LLUDPClient UDPClient { get { return m_udpClient; } }
@@ -413,34 +617,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
413 return result; 617 return result;
414 } 618 }
415 619
416 /*protected void DebugPacket(string direction, Packet packet)
417 {
418 string info;
419
420 if (m_debugPacketLevel < 255 && packet.Type == PacketType.AgentUpdate)
421 return;
422 if (m_debugPacketLevel < 254 && packet.Type == PacketType.ViewerEffect)
423 return;
424 if (m_debugPacketLevel < 253 && (
425 packet.Type == PacketType.CompletePingCheck ||
426 packet.Type == PacketType.StartPingCheck
427 ))
428 return;
429 if (m_debugPacketLevel < 252 && packet.Type == PacketType.PacketAck)
430 return;
431
432 if (m_debugPacketLevel > 1)
433 {
434 info = packet.ToString();
435 }
436 else
437 {
438 info = packet.Type.ToString();
439 }
440
441 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
442 }*/
443
444 #endregion Packet Handling 620 #endregion Packet Handling
445 621
446 # region Setup 622 # region Setup
@@ -523,207 +699,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
523 699
524 # endregion 700 # endregion
525 701
526 #region Events
527
528 public event GenericMessage OnGenericMessage;
529 public event BinaryGenericMessage OnBinaryGenericMessage;
530 public event Action<IClientAPI> OnLogout;
531 public event ObjectPermissions OnObjectPermissions;
532 public event Action<IClientAPI> OnConnectionClosed;
533 public event ViewerEffectEventHandler OnViewerEffect;
534 public event ImprovedInstantMessage OnInstantMessage;
535 public event ChatMessage OnChatFromClient;
536 public event TextureRequest OnRequestTexture;
537 public event RezObject OnRezObject;
538 public event DeRezObject OnDeRezObject;
539 public event ModifyTerrain OnModifyTerrain;
540 public event Action<IClientAPI> OnRegionHandShakeReply;
541 public event GenericCall2 OnRequestWearables;
542 public event SetAppearance OnSetAppearance;
543 public event AvatarNowWearing OnAvatarNowWearing;
544 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
545 public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
546 public event UUIDNameRequest OnDetachAttachmentIntoInv;
547 public event ObjectAttach OnObjectAttach;
548 public event ObjectDeselect OnObjectDetach;
549 public event ObjectDrop OnObjectDrop;
550 public event GenericCall2 OnCompleteMovementToRegion;
551 public event UpdateAgent OnAgentUpdate;
552 public event AgentRequestSit OnAgentRequestSit;
553 public event AgentSit OnAgentSit;
554 public event AvatarPickerRequest OnAvatarPickerRequest;
555 public event StartAnim OnStartAnim;
556 public event StopAnim OnStopAnim;
557 public event Action<IClientAPI> OnRequestAvatarsData;
558 public event LinkObjects OnLinkObjects;
559 public event DelinkObjects OnDelinkObjects;
560 public event GrabObject OnGrabObject;
561 public event DeGrabObject OnDeGrabObject;
562 public event SpinStart OnSpinStart;
563 public event SpinStop OnSpinStop;
564 public event ObjectDuplicate OnObjectDuplicate;
565 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
566 public event MoveObject OnGrabUpdate;
567 public event SpinObject OnSpinUpdate;
568 public event AddNewPrim OnAddPrim;
569 public event RequestGodlikePowers OnRequestGodlikePowers;
570 public event GodKickUser OnGodKickUser;
571 public event ObjectExtraParams OnUpdateExtraParams;
572 public event UpdateShape OnUpdatePrimShape;
573 public event ObjectRequest OnObjectRequest;
574 public event ObjectSelect OnObjectSelect;
575 public event ObjectDeselect OnObjectDeselect;
576 public event GenericCall7 OnObjectDescription;
577 public event GenericCall7 OnObjectName;
578 public event GenericCall7 OnObjectClickAction;
579 public event GenericCall7 OnObjectMaterial;
580 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
581 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
582 public event UpdatePrimFlags OnUpdatePrimFlags;
583 public event UpdatePrimTexture OnUpdatePrimTexture;
584 public event UpdateVector OnUpdatePrimGroupPosition;
585 public event UpdateVector OnUpdatePrimSinglePosition;
586 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
587 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
588 public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition;
589 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
590 public event UpdateVector OnUpdatePrimScale;
591 public event UpdateVector OnUpdatePrimGroupScale;
592 public event StatusChange OnChildAgentStatus;
593 public event GenericCall2 OnStopMovement;
594 public event Action<UUID> OnRemoveAvatar;
595 public event RequestMapBlocks OnRequestMapBlocks;
596 public event RequestMapName OnMapNameRequest;
597 public event TeleportLocationRequest OnTeleportLocationRequest;
598 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
599 public event DisconnectUser OnDisconnectUser;
600 public event RequestAvatarProperties OnRequestAvatarProperties;
601 public event SetAlwaysRun OnSetAlwaysRun;
602 public event FetchInventory OnAgentDataUpdateRequest;
603 public event TeleportLocationRequest OnSetStartLocationRequest;
604 public event UpdateAvatarProperties OnUpdateAvatarProperties;
605 public event CreateNewInventoryItem OnCreateNewInventoryItem;
606 public event CreateInventoryFolder OnCreateNewInventoryFolder;
607 public event UpdateInventoryFolder OnUpdateInventoryFolder;
608 public event MoveInventoryFolder OnMoveInventoryFolder;
609 public event FetchInventoryDescendents OnFetchInventoryDescendents;
610 public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
611 public event FetchInventory OnFetchInventory;
612 public event RequestTaskInventory OnRequestTaskInventory;
613 public event UpdateInventoryItem OnUpdateInventoryItem;
614 public event CopyInventoryItem OnCopyInventoryItem;
615 public event MoveInventoryItem OnMoveInventoryItem;
616 public event RemoveInventoryItem OnRemoveInventoryItem;
617 public event RemoveInventoryFolder OnRemoveInventoryFolder;
618 public event UDPAssetUploadRequest OnAssetUploadRequest;
619 public event XferReceive OnXferReceive;
620 public event RequestXfer OnRequestXfer;
621 public event ConfirmXfer OnConfirmXfer;
622 public event AbortXfer OnAbortXfer;
623 public event RequestTerrain OnRequestTerrain;
624 public event RezScript OnRezScript;
625 public event UpdateTaskInventory OnUpdateTaskInventory;
626 public event MoveTaskInventory OnMoveTaskItem;
627 public event RemoveTaskInventory OnRemoveTaskItem;
628 public event RequestAsset OnRequestAsset;
629 public event UUIDNameRequest OnNameFromUUIDRequest;
630 public event ParcelAccessListRequest OnParcelAccessListRequest;
631 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
632 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
633 public event ParcelDivideRequest OnParcelDivideRequest;
634 public event ParcelJoinRequest OnParcelJoinRequest;
635 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
636 public event ParcelSelectObjects OnParcelSelectObjects;
637 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
638 public event ParcelAbandonRequest OnParcelAbandonRequest;
639 public event ParcelGodForceOwner OnParcelGodForceOwner;
640 public event ParcelReclaim OnParcelReclaim;
641 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
642 public event ParcelDeedToGroup OnParcelDeedToGroup;
643 public event RegionInfoRequest OnRegionInfoRequest;
644 public event EstateCovenantRequest OnEstateCovenantRequest;
645 public event FriendActionDelegate OnApproveFriendRequest;
646 public event FriendActionDelegate OnDenyFriendRequest;
647 public event FriendshipTermination OnTerminateFriendship;
648 public event MoneyTransferRequest OnMoneyTransferRequest;
649 public event EconomyDataRequest OnEconomyDataRequest;
650 public event MoneyBalanceRequest OnMoneyBalanceRequest;
651 public event ParcelBuy OnParcelBuy;
652 public event UUIDNameRequest OnTeleportHomeRequest;
653 public event UUIDNameRequest OnUUIDGroupNameRequest;
654 public event ScriptAnswer OnScriptAnswer;
655 public event RequestPayPrice OnRequestPayPrice;
656 public event ObjectSaleInfo OnObjectSaleInfo;
657 public event ObjectBuy OnObjectBuy;
658 public event BuyObjectInventory OnBuyObjectInventory;
659 public event AgentSit OnUndo;
660 public event ForceReleaseControls OnForceReleaseControls;
661 public event GodLandStatRequest OnLandStatRequest;
662 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
663 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
664 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
665 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
666 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
667 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
668 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
669 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
670 public event BakeTerrain OnBakeTerrain;
671 public event RequestTerrain OnUploadTerrain;
672 public event EstateChangeInfo OnEstateChangeInfo;
673 public event EstateRestartSimRequest OnEstateRestartSimRequest;
674 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
675 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
676 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
677 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
678 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
679 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
680 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
681 public event RegionHandleRequest OnRegionHandleRequest;
682 public event ParcelInfoRequest OnParcelInfoRequest;
683 public event ScriptReset OnScriptReset;
684 public event GetScriptRunning OnGetScriptRunning;
685 public event SetScriptRunning OnSetScriptRunning;
686 public event UpdateVector OnAutoPilotGo;
687 public event TerrainUnacked OnUnackedTerrain;
688 public event ActivateGesture OnActivateGesture;
689 public event DeactivateGesture OnDeactivateGesture;
690 public event ObjectOwner OnObjectOwner;
691 public event DirPlacesQuery OnDirPlacesQuery;
692 public event DirFindQuery OnDirFindQuery;
693 public event DirLandQuery OnDirLandQuery;
694 public event DirPopularQuery OnDirPopularQuery;
695 public event DirClassifiedQuery OnDirClassifiedQuery;
696 public event EventInfoRequest OnEventInfoRequest;
697 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
698 public event MapItemRequest OnMapItemRequest;
699 public event OfferCallingCard OnOfferCallingCard;
700 public event AcceptCallingCard OnAcceptCallingCard;
701 public event DeclineCallingCard OnDeclineCallingCard;
702 public event SoundTrigger OnSoundTrigger;
703 public event StartLure OnStartLure;
704 public event TeleportLureRequest OnTeleportLureRequest;
705 public event NetworkStats OnNetworkStatsUpdate;
706 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
707 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
708 public event ClassifiedDelete OnClassifiedDelete;
709 public event ClassifiedDelete OnClassifiedGodDelete;
710 public event EventNotificationAddRequest OnEventNotificationAddRequest;
711 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
712 public event EventGodDelete OnEventGodDelete;
713 public event ParcelDwellRequest OnParcelDwellRequest;
714 public event UserInfoRequest OnUserInfoRequest;
715 public event UpdateUserInfo OnUpdateUserInfo;
716 public event RetrieveInstantMessages OnRetrieveInstantMessages;
717 public event PickDelete OnPickDelete;
718 public event PickGodDelete OnPickGodDelete;
719 public event PickInfoUpdate OnPickInfoUpdate;
720 public event AvatarNotesUpdate OnAvatarNotesUpdate;
721 public event MuteListRequest OnMuteListRequest;
722 public event AvatarInterestUpdate OnAvatarInterestUpdate;
723 public event PlacesQuery OnPlacesQuery;
724
725 #endregion Events
726
727 public void ActivateGesture(UUID assetId, UUID gestureId) 702 public void ActivateGesture(UUID assetId, UUID gestureId)
728 { 703 {
729 } 704 }
@@ -3367,7 +3342,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3367 int length = 0; 3342 int length = 0;
3368 m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length); 3343 m_avatarTerseUpdates[count].ToBytes(blockbuffer, ref length);
3369 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); 3344 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3370 if (size + length > m_packetMTU) 3345 if (size + length > Packet.MTU)
3371 break; 3346 break;
3372 size += length; 3347 size += length;
3373 } 3348 }
@@ -3611,7 +3586,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3611 int length = 0; 3586 int length = 0;
3612 m_primFullUpdates[count].ToBytes(blockbuffer, ref length); 3587 m_primFullUpdates[count].ToBytes(blockbuffer, ref length);
3613 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); 3588 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3614 if (size + length > m_packetMTU) 3589 if (size + length > Packet.MTU)
3615 break; 3590 break;
3616 size += length; 3591 size += length;
3617 } 3592 }
@@ -3699,7 +3674,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3699 int length = 0; 3674 int length = 0;
3700 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); 3675 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
3701 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer); 3676 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3702 if (size + length > m_packetMTU) 3677 if (size + length > Packet.MTU)
3703 break; 3678 break;
3704 size += length; 3679 size += length;
3705 } 3680 }
@@ -4802,7 +4777,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4802 4777
4803 public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) 4778 public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack)
4804 { 4779 {
4805
4806 ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack; 4780 ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack;
4807 if (ogpack.AgentData.SessionID != SessionId) return false; 4781 if (ogpack.AgentData.SessionID != SessionId) return false;
4808 4782
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 2228f39..04c9cb1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -419,7 +419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
419 419
420 int dataLength = buffer.DataLength; 420 int dataLength = buffer.DataLength;
421 421
422 // Keep appending ACKs until there is no room left in the packet or there are 422 // Keep appending ACKs until there is no room left in the buffer or there are
423 // no more ACKs to append 423 // no more ACKs to append
424 uint ackCount = 0; 424 uint ackCount = 0;
425 uint ack; 425 uint ack;
@@ -654,11 +654,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
654 654
655 // Create the LLClientView 655 // Create the LLClientView
656 LLClientView clientApi = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 656 LLClientView clientApi = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
657 clientApi.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler;
658 clientApi.OnLogout += LogoutHandler; 657 clientApi.OnLogout += LogoutHandler;
659 clientApi.OnConnectionClosed += 658 clientApi.OnConnectionClosed += ConnectionClosedHandler;
660 delegate(IClientAPI client)
661 { if (client is LLClientView) RemoveClient(((LLClientView)client).UDPClient); };
662 659
663 // Start the IClientAPI 660 // Start the IClientAPI
664 m_scene.ClientManager.Add(circuitCode, clientApi); 661 m_scene.ClientManager.Add(circuitCode, clientApi);
@@ -808,7 +805,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
808 805
809 private void LogoutHandler(IClientAPI client) 806 private void LogoutHandler(IClientAPI client)
810 { 807 {
808 client.OnLogout -= LogoutHandler;
809
811 client.SendLogoutPacket(); 810 client.SendLogoutPacket();
811
812 if (client is LLClientView)
813 RemoveClient(((LLClientView)client).UDPClient);
814 }
815
816 private void ConnectionClosedHandler(IClientAPI client)
817 {
818 client.OnConnectionClosed -= ConnectionClosedHandler;
819
812 if (client is LLClientView) 820 if (client is LLClientView)
813 RemoveClient(((LLClientView)client).UDPClient); 821 RemoveClient(((LLClientView)client).UDPClient);
814 } 822 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 4ae4dc3..dbbf679 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -390,6 +390,32 @@ namespace OpenSim.Region.Framework.Scenes
390 EventManager.TriggerScriptReset(part.LocalId, itemID); 390 EventManager.TriggerScriptReset(part.LocalId, itemID);
391 } 391 }
392 } 392 }
393
394 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
395 {
396 // TODO: don't create new blocks if recycling an old packet
397 List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
398 for (int i = 0; i < args.Count; i++)
399 {
400 ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
401 effect.AgentID = args[i].AgentID;
402 effect.Color = args[i].Color;
403 effect.Duration = args[i].Duration;
404 effect.ID = args[i].ID;
405 effect.Type = args[i].Type;
406 effect.TypeData = args[i].TypeData;
407 effectBlock.Add(effect);
408 }
409 ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
410
411 ClientManager.ForEachClient(
412 delegate(IClientAPI client)
413 {
414 if (client.AgentId != remoteClient.AgentId)
415 client.SendViewerEffect(effectBlockArray);
416 }
417 );
418 }
393 419
394 /// <summary> 420 /// <summary>
395 /// Handle a fetch inventory request from the client 421 /// Handle a fetch inventory request from the client
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cffb23c..e81b07b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2572,6 +2572,7 @@ namespace OpenSim.Region.Framework.Scenes
2572 public virtual void SubscribeToClientNetworkEvents(IClientAPI client) 2572 public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
2573 { 2573 {
2574 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; 2574 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
2575 client.OnViewerEffect += ProcessViewerEffect;
2575 } 2576 }
2576 2577
2577 protected virtual void UnsubscribeToClientEvents(IClientAPI client) 2578 protected virtual void UnsubscribeToClientEvents(IClientAPI client)
@@ -2726,11 +2727,9 @@ namespace OpenSim.Region.Framework.Scenes
2726 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client) 2727 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
2727 { 2728 {
2728 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats; 2729 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats;
2730 client.OnViewerEffect -= ProcessViewerEffect;
2729 } 2731 }
2730 2732
2731
2732
2733
2734 /// <summary> 2733 /// <summary>
2735 /// Teleport an avatar to their home region 2734 /// Teleport an avatar to their home region
2736 /// </summary> 2735 /// </summary>
@@ -3053,16 +3052,6 @@ namespace OpenSim.Region.Framework.Scenes
3053 } 3052 }
3054 3053
3055 /// <summary> 3054 /// <summary>
3056 /// Closes all endpoints with the circuitcode provided.
3057 /// </summary>
3058 /// <param name="circuitcode">Circuit Code of the endpoint to close</param>
3059 public override void CloseAllAgents(uint circuitcode)
3060 {
3061 // Called by ClientView to kill all circuit codes
3062 ClientManager.CloseAllAgents(circuitcode);
3063 }
3064
3065 /// <summary>
3066 /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap. 3055 /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
3067 /// </summary> 3056 /// </summary>
3068 public void NotifyMyCoarseLocationChange() 3057 public void NotifyMyCoarseLocationChange()
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 0ac4ed4..cf5c3c8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -196,8 +196,6 @@ namespace OpenSim.Region.Framework.Scenes
196 /// <param name="agentID"></param> 196 /// <param name="agentID"></param>
197 public abstract void RemoveClient(UUID agentID); 197 public abstract void RemoveClient(UUID agentID);
198 198
199 public abstract void CloseAllAgents(uint circuitcode);
200
201 #endregion 199 #endregion
202 200
203 /// <summary> 201 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
index 5c9e66f..8230f32 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs
@@ -61,11 +61,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
61 throw new NotImplementedException(); 61 throw new NotImplementedException();
62 } 62 }
63 63
64 public override void CloseAllAgents(uint circuitcode)
65 {
66 throw new NotImplementedException();
67 }
68
69 public override void OtherRegionUp(GridRegion otherRegion) 64 public override void OtherRegionUp(GridRegion otherRegion)
70 { 65 {
71 throw new NotImplementedException(); 66 throw new NotImplementedException();