aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs38
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs7
2 files changed, 37 insertions, 8 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}
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}