aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2009-10-26 15:51:28 +0000
committerMelanie2009-10-26 15:51:28 +0000
commit1209db6dcd9e9d8ff15ddbdbb246506817ef9b23 (patch)
tree632f971e555cb37697027c394357976cd4efeaf8 /OpenSim
parentThank you, RemedyTomm, for a patch to handle Xfer requests being dropped (diff)
downloadopensim-SC_OLD-1209db6dcd9e9d8ff15ddbdbb246506817ef9b23.zip
opensim-SC_OLD-1209db6dcd9e9d8ff15ddbdbb246506817ef9b23.tar.gz
opensim-SC_OLD-1209db6dcd9e9d8ff15ddbdbb246506817ef9b23.tar.bz2
opensim-SC_OLD-1209db6dcd9e9d8ff15ddbdbb246506817ef9b23.tar.xz
Thank you, RemedyTomm, for an update to your previous patch. Garbage-collect
the transfers that never happen.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs23
1 files changed, 21 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
index d275b7f..ef7dce8 100644
--- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
@@ -38,15 +38,20 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
38 public class XferModule : IRegionModule, IXfer 38 public class XferModule : IRegionModule, IXfer
39 { 39 {
40 private Scene m_scene; 40 private Scene m_scene;
41 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>();
42 private List<XferRequest> RequestTime = new List<XferRequest>();
41 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); 43 public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
42 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 44 public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
43 public Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); 45
46
44 public struct XferRequest 47 public struct XferRequest
45 { 48 {
46 public IClientAPI remoteClient; 49 public IClientAPI remoteClient;
47 public ulong xferID; 50 public ulong xferID;
51 public string fileName;
52 public DateTime timeStamp;
48 } 53 }
49 54
50 #region IRegionModule Members 55 #region IRegionModule Members
51 56
52 public void Initialise(Scene scene, IConfigSource config) 57 public void Initialise(Scene scene, IConfigSource config)
@@ -138,13 +143,27 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
138 } 143 }
139 else 144 else
140 { 145 {
146 if (RequestTime.Count > 0)
147 {
148 TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
149 if (ts.TotalSeconds > 30)
150 {
151 Requests.Remove(RequestTime[0].fileName);
152 RequestTime.RemoveAt(0);
153 }
154 }
155
141 if (!Requests.ContainsKey(fileName)) 156 if (!Requests.ContainsKey(fileName))
142 { 157 {
143 XferRequest nRequest = new XferRequest(); 158 XferRequest nRequest = new XferRequest();
144 nRequest.remoteClient = remoteClient; 159 nRequest.remoteClient = remoteClient;
145 nRequest.xferID = xferID; 160 nRequest.xferID = xferID;
161 nRequest.fileName = fileName;
162 nRequest.timeStamp = DateTime.UtcNow;
146 Requests.Add(fileName, nRequest); 163 Requests.Add(fileName, nRequest);
164 RequestTime.Add(nRequest);
147 } 165 }
166
148 } 167 }
149 } 168 }
150 } 169 }