diff options
Diffstat (limited to 'OpenSim/Framework/General/ClientManager.cs')
-rw-r--r-- | OpenSim/Framework/General/ClientManager.cs | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs index 274a2d3..b032849 100644 --- a/OpenSim/Framework/General/ClientManager.cs +++ b/OpenSim/Framework/General/ClientManager.cs | |||
@@ -3,6 +3,7 @@ using System.Collections.Generic; | |||
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife.Packets; | 4 | using libsecondlife.Packets; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using libsecondlife; | ||
6 | 7 | ||
7 | namespace OpenSim.Framework | 8 | namespace OpenSim.Framework |
8 | { | 9 | { |
@@ -24,7 +25,7 @@ namespace OpenSim.Framework | |||
24 | m_clients = new Dictionary<uint, IClientAPI>(); | 25 | m_clients = new Dictionary<uint, IClientAPI>(); |
25 | } | 26 | } |
26 | 27 | ||
27 | public void Remove(uint id) | 28 | private void Remove(uint id) |
28 | { | 29 | { |
29 | m_clients.Remove(id); | 30 | m_clients.Remove(id); |
30 | } | 31 | } |
@@ -44,19 +45,46 @@ namespace OpenSim.Framework | |||
44 | } | 45 | } |
45 | } | 46 | } |
46 | 47 | ||
47 | public void ConnectionClosed(uint circuitCode) | 48 | public void CloseAllAgents(uint circuitCode) |
48 | { | 49 | { |
49 | IClientAPI client; | 50 | IClientAPI client; |
50 | 51 | ||
51 | if (m_clients.TryGetValue(circuitCode, out client)) | 52 | if (m_clients.TryGetValue(circuitCode, out client)) |
52 | { | 53 | { |
53 | m_clients.Remove(circuitCode); | 54 | CloseAllCircuits(client.AgentId); |
54 | client.Close(); | 55 | } |
56 | } | ||
57 | |||
58 | public void CloseAllCircuits( LLUUID agentId ) | ||
59 | { | ||
60 | uint[] circuits = GetAllCircuits(agentId); | ||
61 | foreach (uint circuit in circuits ) | ||
62 | { | ||
63 | IClientAPI client; | ||
64 | if (m_clients.TryGetValue(circuit, out client)) | ||
65 | { | ||
66 | Remove(circuit); | ||
67 | client.Close(); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | private uint[] GetAllCircuits(LLUUID agentId) | ||
73 | { | ||
74 | List<uint> circuits = new List<uint>(); | ||
55 | 75 | ||
56 | // TODO: Now remove all local childagents too | 76 | foreach (KeyValuePair<uint, IClientAPI> pair in m_clients) |
77 | { | ||
78 | if( pair.Value.AgentId == agentId ) | ||
79 | { | ||
80 | circuits.Add( pair.Key ); | ||
81 | } | ||
57 | } | 82 | } |
83 | |||
84 | return circuits.ToArray(); | ||
58 | } | 85 | } |
59 | 86 | ||
87 | |||
60 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) | 88 | public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) |
61 | { | 89 | { |
62 | ViewerEffectPacket packet = new ViewerEffectPacket(); | 90 | ViewerEffectPacket packet = new ViewerEffectPacket(); |