aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-06 20:34:18 +0000
committerJustin Clarke Casey2008-02-06 20:34:18 +0000
commit548bbc97e5d6e2ffaa3068aa0847eaa6c401345d (patch)
tree193f5af76e8a680e6d4e566767033e2c6117bd44
parentpass 1 on getting colors back to the console (diff)
downloadopensim-SC_OLD-548bbc97e5d6e2ffaa3068aa0847eaa6c401345d.zip
opensim-SC_OLD-548bbc97e5d6e2ffaa3068aa0847eaa6c401345d.tar.gz
opensim-SC_OLD-548bbc97e5d6e2ffaa3068aa0847eaa6c401345d.tar.bz2
opensim-SC_OLD-548bbc97e5d6e2ffaa3068aa0847eaa6c401345d.tar.xz
* Chasing down memory leak where memory used by a client is not returned on client logout
* This code may or may not be on the right track, but I want to save my work so far.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/ClientManager.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs5
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs38
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs7
5 files changed, 50 insertions, 10 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 8422c17..62ff203 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Framework
68 m_clients = new Dictionary<uint, IClientAPI>(); 68 m_clients = new Dictionary<uint, IClientAPI>();
69 } 69 }
70 70
71 private void Remove(uint id) 71 public void Remove(uint id)
72 { 72 {
73 m_clients.Remove(id); 73 m_clients.Remove(id);
74 } 74 }
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 10bf0d1..aeac1b2 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -51,6 +51,11 @@ namespace OpenSim.Region.ClientStack
51 /// </summary> 51 /// </summary>
52 public class ClientView : IClientAPI 52 public class ClientView : IClientAPI
53 { 53 {
54 ~ClientView()
55 {
56 m_log.Info("[CLIENTVIEW]: Dstructor called");
57 }
58
54 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 59 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
55 60
56 /* static variables */ 61 /* static variables */
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index 7e01adf..9608ce5 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -36,6 +36,9 @@ namespace OpenSim.Region.ClientStack
36{ 36{
37 public class PacketServer 37 public class PacketServer
38 { 38 {
39 private static readonly log4net.ILog m_log
40 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
41
39 private ClientStackNetworkHandler m_networkHandler; 42 private ClientStackNetworkHandler m_networkHandler;
40 private IScene m_scene; 43 private IScene m_scene;
41 44
@@ -132,8 +135,11 @@ namespace OpenSim.Region.ClientStack
132 135
133 public virtual void CloseClient(IClientAPI client) 136 public virtual void CloseClient(IClientAPI client)
134 { 137 {
138 //m_log.Info("PacketServer:CloseClient()");
139
135 CloseCircuit(client.CircuitCode); 140 CloseCircuit(client.CircuitCode);
136 client.Close(false); 141 client.Close(false);
142 m_scene.ClientManager.Remove(client.CircuitCode);
137 } 143 }
138 } 144 }
139} \ No newline at end of file 145}
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index f8da9af..131e2b0 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -97,7 +97,11 @@ namespace OpenSim.Region.Environment.Modules
97 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 97 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
98 Transfers.Add(xferID, transaction); 98 Transfers.Add(xferID, transaction);
99 NewFiles.Remove(fileName); 99 NewFiles.Remove(fileName);
100 transaction.StartSend(); 100
101 if (transaction.StartSend())
102 {
103 Transfers.Remove(xferID);
104 }
101 } 105 }
102 } 106 }
103 } 107 }
@@ -107,7 +111,12 @@ namespace OpenSim.Region.Environment.Modules
107 { 111 {
108 if (Transfers.ContainsKey(xferID)) 112 if (Transfers.ContainsKey(xferID))
109 { 113 {
110 Transfers[xferID].AckPacket(packet); 114 if (Transfers[xferID].AckPacket(packet))
115 {
116 {
117 Transfers.Remove(xferID);
118 }
119 }
111 } 120 }
112 } 121 }
113 122
@@ -137,7 +146,7 @@ namespace OpenSim.Region.Environment.Modules
137 public uint Packet = 0; 146 public uint Packet = 0;
138 public IClientAPI Client; 147 public IClientAPI Client;
139 public uint Serial = 1; 148 public uint Serial = 1;
140 private bool complete = false; 149 private bool complete;
141 150
142 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) 151 public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
143 { 152 {
@@ -151,7 +160,11 @@ namespace OpenSim.Region.Environment.Modules
151 { 160 {
152 } 161 }
153 162
154 public void StartSend() 163 /// <summary>
164 /// Start a transfer
165 /// </summary>
166 /// <returns>True if the transfer is complete, false if not</returns>
167 public bool StartSend()
155 { 168 {
156 if (Data.Length < 1000) 169 if (Data.Length < 1000)
157 { 170 {
@@ -160,6 +173,7 @@ namespace OpenSim.Region.Environment.Modules
160 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); 173 Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
161 Array.Copy(Data, 0, transferData, 4, Data.Length); 174 Array.Copy(Data, 0, transferData, 4, Data.Length);
162 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); 175 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
176
163 complete = true; 177 complete = true;
164 } 178 }
165 else 179 else
@@ -169,11 +183,18 @@ namespace OpenSim.Region.Environment.Modules
169 Array.Copy(Data, 0, transferData, 4, 1000); 183 Array.Copy(Data, 0, transferData, 4, 1000);
170 Client.SendXferPacket(XferID, 0, transferData); 184 Client.SendXferPacket(XferID, 0, transferData);
171 Packet++; 185 Packet++;
172 DataPointer = 1000; 186 DataPointer = 1000;
173 } 187 }
188
189 return complete;
174 } 190 }
175 191
176 public void AckPacket(uint packet) 192 /// <summary>
193 /// Respond to an ack packet from the client
194 /// </summary>
195 /// <param name="packet"></param>
196 /// <returns>True if the transfer is complete, false otherwise</returns>
197 public bool AckPacket(uint packet)
177 { 198 {
178 if (!complete) 199 if (!complete)
179 { 200 {
@@ -193,10 +214,13 @@ namespace OpenSim.Region.Environment.Modules
193 Client.SendXferPacket(XferID, endPacket, transferData); 214 Client.SendXferPacket(XferID, endPacket, transferData);
194 Packet++; 215 Packet++;
195 DataPointer += (Data.Length - DataPointer); 216 DataPointer += (Data.Length - DataPointer);
217
196 complete = true; 218 complete = true;
197 } 219 }
198 } 220 }
221
222 return complete;
199 } 223 }
200 } 224 }
201 } 225 }
202} \ No newline at end of file 226}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 109f23c..4062ef6 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -39,6 +39,11 @@ namespace OpenSim.Region.Environment.Scenes
39{ 39{
40 public class ScenePresence : EntityBase 40 public class ScenePresence : EntityBase
41 { 41 {
42 ~ScenePresence()
43 {
44 m_log.Info("[ScenePresence] Destructor called");
45 }
46
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 48
44 public static AvatarAnimations Animations = new AvatarAnimations(); 49 public static AvatarAnimations Animations = new AvatarAnimations();
@@ -1728,4 +1733,4 @@ namespace OpenSim.Region.Environment.Scenes
1728 RemoveFromPhysicalScene(); 1733 RemoveFromPhysicalScene();
1729 } 1734 }
1730 } 1735 }
1731} \ No newline at end of file 1736}