aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
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 /OpenSim/Region/Environment/Modules
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 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs38
1 files changed, 31 insertions, 7 deletions
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}