aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs94
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs9
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs5
3 files changed, 25 insertions, 83 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
index df4ff05..b8e2820 100644
--- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
@@ -27,7 +27,9 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
30using Nini.Config; 31using Nini.Config;
32using log4net;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenSim.Framework; 34using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
@@ -37,12 +39,11 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
37{ 39{
38 public class XferModule : IRegionModule, IXfer 40 public class XferModule : IRegionModule, IXfer
39 { 41 {
40 private static uint counter = 0;
41 private Scene m_scene; 42 private Scene m_scene;
42 private Dictionary<string, XferRequest> Requests = new Dictionary<string, 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
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 47
47 public struct XferRequest 48 public struct XferRequest
48 { 49 {
@@ -90,6 +91,14 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
90 91
91 #region IXfer Members 92 #region IXfer Members
92 93
94 /// <summary>
95 /// Let the Xfer module know about a file that the client is about to request.
96 /// Caller is responsible for making sure that the file is here before
97 /// the client starts the XferRequest.
98 /// </summary>
99 /// <param name="fileName"></param>
100 /// <param name="data"></param>
101 /// <returns></returns>
93 public bool AddNewFile(string fileName, byte[] data) 102 public bool AddNewFile(string fileName, byte[] data)
94 { 103 {
95 lock (NewFiles) 104 lock (NewFiles)
@@ -97,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
97 if (NewFiles.ContainsKey(fileName)) 106 if (NewFiles.ContainsKey(fileName))
98 { 107 {
99 NewFiles[fileName].Count++; 108 NewFiles[fileName].Count++;
100 //Console.WriteLine("AddNewFile " + fileName + " counter=" + NewFiles[fileName].Count); 109 NewFiles[fileName].Data = data;
101 } 110 }
102 else 111 else
103 { 112 {
@@ -105,23 +114,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
105 fd.Count = 1; 114 fd.Count = 1;
106 fd.Data = data; 115 fd.Data = data;
107 NewFiles.Add(fileName, fd); 116 NewFiles.Add(fileName, fd);
108 //Console.WriteLine("AddNewFile " + fileName);
109 } 117 }
110 } 118 }
111 119
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.
117 if (Requests.ContainsKey(fileName))
118 {
119 //Console.WriteLine("*** AddNewFile Requests.Contains " + fileName);
120
121 RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName);
122 Requests.Remove(fileName);
123 }
124
125 return true; 120 return true;
126 } 121 }
127 122
@@ -144,23 +139,17 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
144 { 139 {
145 lock (NewFiles) 140 lock (NewFiles)
146 { 141 {
147 //Console.WriteLine("---- RequestXfer " + fileName + " ----");
148
149 if (NewFiles.ContainsKey(fileName)) 142 if (NewFiles.ContainsKey(fileName))
150 { 143 {
151 //Console.WriteLine("NewFiles.ContainsKey " + fileName + " with count=" + NewFiles[fileName].Count);
152 if (!Transfers.ContainsKey(xferID)) 144 if (!Transfers.ContainsKey(xferID))
153 { 145 {
154 //Console.WriteLine("!Transfers.ContainsKey("+xferID+")");
155 byte[] fileData = NewFiles[fileName].Data; 146 byte[] fileData = NewFiles[fileName].Data;
156 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); 147 XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
157 148
158 Transfers.Add(xferID, transaction); 149 Transfers.Add(xferID, transaction);
159 150
160 if (transaction.StartSend()) 151 if (transaction.StartSend())
161 {
162 RemoveXferData(xferID); 152 RemoveXferData(xferID);
163 }
164 153
165 // The transaction for this file is either complete or on its way 154 // The transaction for this file is either complete or on its way
166 RemoveOrDecrement(fileName); 155 RemoveOrDecrement(fileName);
@@ -168,42 +157,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
168 } 157 }
169 } 158 }
170 else 159 else
171 { 160 m_log.WarnFormat("[Xfer]: {0} not found", fileName);
172 ////Console.WriteLine("*** ! NewFiles.ContainsKey " + fileName);
173 //if (RequestTime.Count > 0)
174 //{
175 // //Console.WriteLine("RequestTime.Count > 0");
176 // TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - RequestTime[0].timeStamp.Ticks);
177 // if (ts.TotalSeconds > 30)
178 // {
179 // Console.WriteLine("ts.TotalSeconds > 30");
180 // Requests.Remove(RequestTime[0].fileName);
181 // RequestTime.RemoveAt(0);
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;
193
194 if (!Requests.ContainsKey(fileName))
195 {
196 //Console.WriteLine("**** !Requests.ContainsKey(" + fileName + ")");
197 Requests.Add(fileName, nRequest);
198 }
199 else
200 {
201 //Console.WriteLine("**** Requests.ContainsKey(" + fileName + ")");
202 Requests.Add(fileName + "-" + counter.ToString(), nRequest);
203 counter++;
204 }
205
206 }
207 161
208 } 162 }
209 } 163 }
@@ -220,15 +174,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
220 RemoveXferData(xferID); 174 RemoveXferData(xferID);
221 RemoveOrDecrement(dl.FileName); 175 RemoveOrDecrement(dl.FileName);
222 } 176 }
223 else
224 {
225 if (Requests.ContainsKey(dl.FileName))
226 {
227 XferRequest req = Requests[dl.FileName];
228 req.timeStamp = DateTime.UtcNow;
229 Requests[dl.FileName] = req;
230 }
231 }
232 } 177 }
233 } 178 }
234 } 179 }
@@ -238,19 +183,12 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
238 // NewFiles must be locked! 183 // NewFiles must be locked!
239 if (Transfers.ContainsKey(xferID)) 184 if (Transfers.ContainsKey(xferID))
240 { 185 {
241 // Qualifier distinguishes between the OpenMetaverse version and the nested class
242
243 XferModule.XferDownLoad xferItem = Transfers[xferID]; 186 XferModule.XferDownLoad xferItem = Transfers[xferID];
244 //string filename = xferItem.FileName; 187 //string filename = xferItem.FileName;
245 Transfers.Remove(xferID); 188 Transfers.Remove(xferID);
246 xferItem.Data = new byte[0]; // Clear the data 189 xferItem.Data = new byte[0]; // Clear the data
247 xferItem.DataPointer = 0; 190 xferItem.DataPointer = 0;
248 191
249 // If the abort comes in
250
251 if (Requests.ContainsKey(xferItem.FileName))
252 Requests.Remove(xferItem.FileName);
253
254 } 192 }
255 } 193 }
256 194
@@ -272,13 +210,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
272 if (NewFiles.ContainsKey(fileName)) 210 if (NewFiles.ContainsKey(fileName))
273 { 211 {
274 if (NewFiles[fileName].Count == 1) 212 if (NewFiles[fileName].Count == 1)
275 {
276 NewFiles.Remove(fileName); 213 NewFiles.Remove(fileName);
277 }
278 else 214 else
279 {
280 NewFiles[fileName].Count--; 215 NewFiles[fileName].Count--;
281 }
282 } 216 }
283 } 217 }
284 218
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 9412e09..3cfca4b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -963,15 +963,15 @@ namespace OpenSim.Region.Framework.Scenes
963 return; 963 return;
964 } 964 }
965 965
966 client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
967 Util.StringToBytes256(m_inventoryFileName));
968
969 if (!changed) 966 if (!changed)
970 { 967 {
971 if (m_inventoryFileData.Length > 2) 968 if (m_inventoryFileData.Length > 2)
972 { 969 {
973 xferManager.AddNewFile(m_inventoryFileName, 970 xferManager.AddNewFile(m_inventoryFileName,
974 m_inventoryFileData); 971 m_inventoryFileData);
972 client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
973 Util.StringToBytes256(m_inventoryFileName));
974
975 Items.LockItemsForRead(false); 975 Items.LockItemsForRead(false);
976 return; 976 return;
977 } 977 }
@@ -1037,6 +1037,9 @@ namespace OpenSim.Region.Framework.Scenes
1037 { 1037 {
1038 xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); 1038 xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData);
1039 } 1039 }
1040
1041 client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
1042 Util.StringToBytes256(m_inventoryFileName));
1040 } 1043 }
1041 1044
1042 /// <summary> 1045 /// <summary>
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 2a66060..0e7dd81 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1127,6 +1127,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1127 _position.Y = vec.Y; 1127 _position.Y = vec.Y;
1128 _position.Z = vec.Z; 1128 _position.Z = vec.Z;
1129 1129
1130 // I think we need to update the taintPosition too -- Diva 12/24/10
1131 m_taintPosition.X = vec.X;
1132 m_taintPosition.Y = vec.Y;
1133 m_taintPosition.Z = vec.Z;
1134
1130 // Did we move last? = zeroflag 1135 // Did we move last? = zeroflag
1131 // This helps keep us from sliding all over 1136 // This helps keep us from sliding all over
1132 1137