aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2010-12-23 19:31:37 -0800
committerDiva Canto2010-12-23 19:31:37 -0800
commit135b012bbd44ba04eca52fb901a93faca97cf02d (patch)
tree01135345551f290f46f2413a7957f09e11db8305 /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://MyConnection/var/git/opensim (diff)
downloadopensim-SC_OLD-135b012bbd44ba04eca52fb901a93faca97cf02d.zip
opensim-SC_OLD-135b012bbd44ba04eca52fb901a93faca97cf02d.tar.gz
opensim-SC_OLD-135b012bbd44ba04eca52fb901a93faca97cf02d.tar.bz2
opensim-SC_OLD-135b012bbd44ba04eca52fb901a93faca97cf02d.tar.xz
Hopefully this fixes all prim inventory issues. No more abort, no more keeping track of time. Simply handle the issues, which are: (1) rapid double requests from the viewer for the same file; (2) sometimes the file generation takes too long and the Xfer request arrives at the XferModule before the file name is added.
This still has debug messages commented out, in case this needs more debugging. Pushing it so others can test.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs84
1 files changed, 49 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
index 4f9e32b..df4ff05 100644
--- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
@@ -37,9 +37,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
37{ 37{
38 public class XferModule : IRegionModule, IXfer 38 public class XferModule : IRegionModule, IXfer
39 { 39 {
40 private static uint counter = 0;
40 private Scene m_scene; 41 private Scene m_scene;
41 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); 42 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>();
42 private List<XferRequest> RequestTime = new List<XferRequest>();
43 private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>(); 43 private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>();
44 private Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); 44 private Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
45 45
@@ -95,18 +95,29 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
95 lock (NewFiles) 95 lock (NewFiles)
96 { 96 {
97 if (NewFiles.ContainsKey(fileName)) 97 if (NewFiles.ContainsKey(fileName))
98 {
98 NewFiles[fileName].Count++; 99 NewFiles[fileName].Count++;
100 //Console.WriteLine("AddNewFile " + fileName + " counter=" + NewFiles[fileName].Count);
101 }
99 else 102 else
100 { 103 {
101 FileData fd = new FileData(); 104 FileData fd = new FileData();
102 fd.Count = 1; 105 fd.Count = 1;
103 fd.Data = data; 106 fd.Data = data;
104 NewFiles.Add(fileName, fd); 107 NewFiles.Add(fileName, fd);
108 //Console.WriteLine("AddNewFile " + fileName);
105 } 109 }
106 } 110 }
107 111
112 // This happens when the Xfer request ends up coming before
113 // the fileName is added by this method. That may happen when
114 // the file generation (the event that calle this method)
115 // takes a long time. In this case, we need to kick the
116 // Xfer request mannually.
108 if (Requests.ContainsKey(fileName)) 117 if (Requests.ContainsKey(fileName))
109 { 118 {
119 //Console.WriteLine("*** AddNewFile Requests.Contains " + fileName);
120
110 RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName); 121 RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName);
111 Requests.Remove(fileName); 122 Requests.Remove(fileName);
112 } 123 }
@@ -133,22 +144,14 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
133 { 144 {
134 lock (NewFiles) 145 lock (NewFiles)
135 { 146 {
136 if (RequestTime.Count > 0) 147 //Console.WriteLine("---- RequestXfer " + fileName + " ----");
137 {
138 TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
139 if (ts.TotalSeconds > 30)
140 {
141 ulong zxferid = RequestTime[0].xferID;
142 remoteClient.SendAbortXferPacket(zxferid);
143 RemoveXferData(zxferid);
144 RemoveOrDecrement(fileName);
145 }
146 }
147 148
148 if (NewFiles.ContainsKey(fileName)) 149 if (NewFiles.ContainsKey(fileName))
149 { 150 {
151 //Console.WriteLine("NewFiles.ContainsKey " + fileName + " with count=" + NewFiles[fileName].Count);
150 if (!Transfers.ContainsKey(xferID)) 152 if (!Transfers.ContainsKey(xferID))
151 { 153 {
154 //Console.WriteLine("!Transfers.ContainsKey("+xferID+")");
152 byte[] fileData = NewFiles[fileName].Data; 155 byte[] fileData = NewFiles[fileName].Data;
153 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 156 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
154 157
@@ -166,27 +169,38 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
166 } 169 }
167 else 170 else
168 { 171 {
169 if (RequestTime.Count > 0) 172 ////Console.WriteLine("*** ! NewFiles.ContainsKey " + fileName);
170 { 173 //if (RequestTime.Count > 0)
171 TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks); 174 //{
172 if (ts.TotalSeconds > 30) 175 // //Console.WriteLine("RequestTime.Count > 0");
173 { 176 // TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
174 Requests.Remove(RequestTime[0].fileName); 177 // if (ts.TotalSeconds > 30)
175 RequestTime.RemoveAt(0); 178 // {
176 // Do we want to abort this here? 179 // Console.WriteLine("ts.TotalSeconds > 30");
177 //remoteClient.SendAbortXfer(xferID); 180 // Requests.Remove(RequestTime[0].fileName);
178 } 181 // RequestTime.RemoveAt(0);
179 } 182 // // Do we want to abort this here?
183 // //remoteClient.SendAbortXfer(xferID);
184 // }
185 //}
186
187 XferRequest nRequest = new XferRequest();
188 nRequest.remoteClient = remoteClient;
189 nRequest.xferID = xferID;
190 nRequest.fileName = fileName;
191 nRequest.timeStamp = DateTime.UtcNow;
192 nRequest.fileName = fileName;
180 193
181 if (!Requests.ContainsKey(fileName)) 194 if (!Requests.ContainsKey(fileName))
182 { 195 {
183 XferRequest nRequest = new XferRequest(); 196 //Console.WriteLine("**** !Requests.ContainsKey(" + fileName + ")");
184 nRequest.remoteClient = remoteClient;
185 nRequest.xferID = xferID;
186 nRequest.fileName = fileName;
187 nRequest.timeStamp = DateTime.UtcNow;
188 Requests.Add(fileName, nRequest); 197 Requests.Add(fileName, nRequest);
189 RequestTime.Add(nRequest); 198 }
199 else
200 {
201 //Console.WriteLine("**** Requests.ContainsKey(" + fileName + ")");
202 Requests.Add(fileName + "-" + counter.ToString(), nRequest);
203 counter++;
190 } 204 }
191 205
192 } 206 }
@@ -203,17 +217,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
203 XferDownLoad dl = Transfers[xferID]; 217 XferDownLoad dl = Transfers[xferID];
204 if (Transfers[xferID].AckPacket(packet)) 218 if (Transfers[xferID].AckPacket(packet))
205 { 219 {
206 { 220 RemoveXferData(xferID);
207 RemoveXferData(xferID); 221 RemoveOrDecrement(dl.FileName);
208 RemoveOrDecrement(dl.FileName);
209 }
210 } 222 }
211 else 223 else
212 { 224 {
213
214 if (Requests.ContainsKey(dl.FileName)) 225 if (Requests.ContainsKey(dl.FileName))
215 { 226 {
216 //
217 XferRequest req = Requests[dl.FileName]; 227 XferRequest req = Requests[dl.FileName];
218 req.timeStamp = DateTime.UtcNow; 228 req.timeStamp = DateTime.UtcNow;
219 Requests[dl.FileName] = req; 229 Requests[dl.FileName] = req;
@@ -262,9 +272,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
262 if (NewFiles.ContainsKey(fileName)) 272 if (NewFiles.ContainsKey(fileName))
263 { 273 {
264 if (NewFiles[fileName].Count == 1) 274 if (NewFiles[fileName].Count == 1)
275 {
265 NewFiles.Remove(fileName); 276 NewFiles.Remove(fileName);
277 }
266 else 278 else
279 {
267 NewFiles[fileName].Count--; 280 NewFiles[fileName].Count--;
281 }
268 } 282 }
269 } 283 }
270 284