diff options
author | lbsa71 | 2007-09-18 13:29:16 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-18 13:29:16 +0000 |
commit | 70d9cec3b5064d874f8b9622804c964beeac5f0d (patch) | |
tree | 29d4ae5a6082ea509f5c92a50582bd9b365c7a0f /OpenSim/Framework/General/ClientManager.cs | |
parent | * Handlerized ViewerEffect (diff) | |
download | opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.zip opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.gz opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.bz2 opensim-SC-70d9cec3b5064d874f8b9622804c964beeac5f0d.tar.xz |
* Yet some more connectivity restructuring
* We now have CloseAllAgents( circuit ) and CloseAllCircuits( agentId ) for great justice ( but alas, still only closing on one single scene - be brave! )
* Login and ConnectionClosed now eventified and moveified awayified
* Killed off unused NullClientAPI
* Now the client is almost only responsible for its own closing. ( I will get that scene out of there )
* Lookin' good!
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(); |