aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/ClientManager.cs
diff options
context:
space:
mode:
authorAdam Johnson2007-12-28 08:51:39 +0000
committerAdam Johnson2007-12-28 08:51:39 +0000
commit79496381fc68cbd30ff5a95d1f05fcb18c6b1a93 (patch)
tree036414391293354da62fe9eac1895483111480a3 /OpenSim/Framework/ClientManager.cs
parent* Moved PrimitiveBaseShape subclasses into factory methods - the subclassing ... (diff)
downloadopensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.zip
opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.gz
opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.bz2
opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.xz
Patch from Johan: LibSL updated to the latest revision (1568) and all packets are now
recycled to improve performance and memory usage.
Diffstat (limited to 'OpenSim/Framework/ClientManager.cs')
-rw-r--r--OpenSim/Framework/ClientManager.cs26
1 files changed, 13 insertions, 13 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index da60ed7..181000c 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -26,11 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using libsecondlife; 30using libsecondlife;
32using libsecondlife.Packets; 31using libsecondlife.Packets;
33using OpenSim.Framework.Console;
34 32
35namespace OpenSim.Framework 33namespace OpenSim.Framework
36{ 34{
@@ -42,6 +40,7 @@ namespace OpenSim.Framework
42 40
43 public void ForEachClient(ForEachClientDelegate whatToDo) 41 public void ForEachClient(ForEachClientDelegate whatToDo)
44 { 42 {
43
45 // Wasteful, I know 44 // Wasteful, I know
46 IClientAPI[] LocalClients = new IClientAPI[0]; 45 IClientAPI[] LocalClients = new IClientAPI[0];
47 lock (m_clients) 46 lock (m_clients)
@@ -56,11 +55,9 @@ namespace OpenSim.Framework
56 { 55 {
57 whatToDo(LocalClients[i]); 56 whatToDo(LocalClients[i]);
58 } 57 }
59 catch (Exception e) 58 catch (System.Exception e)
60 { 59 {
61 MainLog.Instance.Warn("CLIENT", 60 OpenSim.Framework.Console.MainLog.Instance.Warn("CLIENT", "Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString());
62 "Unable to do ForEachClient for one of the clients" + "\n Reason: " +
63 e.ToString());
64 } 61 }
65 } 62 }
66 } 63 }
@@ -110,19 +107,20 @@ namespace OpenSim.Framework
110 IClientAPI client; 107 IClientAPI client;
111 try 108 try
112 { 109 {
110
113 if (m_clients.TryGetValue(circuits[i], out client)) 111 if (m_clients.TryGetValue(circuits[i], out client))
114 { 112 {
115 Remove(client.CircuitCode); 113 Remove(client.CircuitCode);
116 client.Close(false); 114 client.Close(false);
117 } 115 }
118 } 116 }
119 catch (Exception e) 117 catch (System.Exception e)
120 { 118 {
121 MainLog.Instance.Error("CLIENT", 119 OpenSim.Framework.Console.MainLog.Instance.Error("CLIENT", "Unable to shutdown circuit for: " + agentId.ToString() + "\n Reason: " + e.ToString());
122 "Unable to shutdown circuit for: " + agentId.ToString() + "\n Reason: " +
123 e.ToString());
124 } 120 }
125 } 121 }
122
123
126 } 124 }
127 125
128 private uint[] GetAllCircuits(LLUUID agentId) 126 private uint[] GetAllCircuits(LLUUID agentId)
@@ -137,7 +135,7 @@ namespace OpenSim.Framework
137 } 135 }
138 136
139 137
140 for (int i = 0; i < LocalClients.Length; i++) 138 for (int i = 0; i < LocalClients.Length; i++ )
141 { 139 {
142 if (LocalClients[i].AgentId == agentId) 140 if (LocalClients[i].AgentId == agentId)
143 { 141 {
@@ -150,7 +148,8 @@ namespace OpenSim.Framework
150 148
151 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) 149 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
152 { 150 {
153 ViewerEffectPacket packet = new ViewerEffectPacket(); 151 ViewerEffectPacket packet = (ViewerEffectPacket) PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
152 // TODO: don't create new blocks if recycling an old packet
154 packet.Effect = effectBlock; 153 packet.Effect = effectBlock;
155 154
156 // Wasteful, I know 155 // Wasteful, I know
@@ -170,6 +169,7 @@ namespace OpenSim.Framework
170 packet.AgentData.SessionID = LocalClients[i].SessionId; 169 packet.AgentData.SessionID = LocalClients[i].SessionId;
171 LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task); 170 LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task);
172 } 171 }
172
173 } 173 }
174 } 174 }
175 175
@@ -178,4 +178,4 @@ namespace OpenSim.Framework
178 return m_clients.TryGetValue(circuitId, out user); 178 return m_clients.TryGetValue(circuitId, out user);
179 } 179 }
180 } 180 }
181} \ No newline at end of file 181}