diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | 3 |
2 files changed, 43 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 57875da..c5a6e62 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | |||
@@ -40,8 +40,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
40 | private Scene m_scene; | 40 | private Scene m_scene; |
41 | private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); | 41 | private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); |
42 | private List<XferRequest> RequestTime = new List<XferRequest>(); | 42 | private List<XferRequest> RequestTime = new List<XferRequest>(); |
43 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 43 | private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>(); |
44 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 44 | private Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
45 | 45 | ||
46 | 46 | ||
47 | public struct XferRequest | 47 | public struct XferRequest |
@@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
51 | public string fileName; | 51 | public string fileName; |
52 | public DateTime timeStamp; | 52 | public DateTime timeStamp; |
53 | } | 53 | } |
54 | |||
55 | private class FileData | ||
56 | { | ||
57 | public byte[] Data; | ||
58 | public int Count; | ||
59 | } | ||
54 | 60 | ||
55 | #region IRegionModule Members | 61 | #region IRegionModule Members |
56 | 62 | ||
@@ -89,21 +95,22 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
89 | lock (NewFiles) | 95 | lock (NewFiles) |
90 | { | 96 | { |
91 | if (NewFiles.ContainsKey(fileName)) | 97 | if (NewFiles.ContainsKey(fileName)) |
92 | { | 98 | NewFiles[fileName].Count++; |
93 | NewFiles[fileName] = data; | ||
94 | } | ||
95 | else | 99 | else |
96 | { | 100 | { |
97 | NewFiles.Add(fileName, data); | 101 | FileData fd = new FileData(); |
102 | fd.Count = 1; | ||
103 | fd.Data = data; | ||
104 | NewFiles.Add(fileName, fd); | ||
98 | } | 105 | } |
99 | } | 106 | } |
100 | string filename = string.Empty; | ||
101 | 107 | ||
102 | if (Requests.ContainsKey(fileName)) | 108 | // This should not be here |
103 | { | 109 | //if (Requests.ContainsKey(fileName)) |
104 | RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName); | 110 | //{ |
105 | Requests.Remove(fileName); | 111 | // RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName); |
106 | } | 112 | // Requests.Remove(fileName); |
113 | //} | ||
107 | 114 | ||
108 | return true; | 115 | return true; |
109 | } | 116 | } |
@@ -135,6 +142,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
135 | ulong zxferid = RequestTime[0].xferID; | 142 | ulong zxferid = RequestTime[0].xferID; |
136 | remoteClient.SendAbortXferPacket(zxferid); | 143 | remoteClient.SendAbortXferPacket(zxferid); |
137 | RemoveXferData(zxferid); | 144 | RemoveXferData(zxferid); |
145 | RemoveOrDecrement(fileName); | ||
138 | } | 146 | } |
139 | } | 147 | } |
140 | 148 | ||
@@ -142,16 +150,19 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
142 | { | 150 | { |
143 | if (!Transfers.ContainsKey(xferID)) | 151 | if (!Transfers.ContainsKey(xferID)) |
144 | { | 152 | { |
145 | byte[] fileData = NewFiles[fileName]; | 153 | byte[] fileData = NewFiles[fileName].Data; |
146 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); | 154 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); |
147 | 155 | ||
148 | Transfers.Add(xferID, transaction); | 156 | Transfers.Add(xferID, transaction); |
149 | NewFiles.Remove(fileName); | ||
150 | 157 | ||
151 | if (transaction.StartSend()) | 158 | if (transaction.StartSend()) |
152 | { | 159 | { |
153 | RemoveXferData(xferID); | 160 | RemoveXferData(xferID); |
154 | } | 161 | } |
162 | |||
163 | // The transaction for this file is either complete or on its way | ||
164 | RemoveOrDecrement(fileName); | ||
165 | |||
155 | } | 166 | } |
156 | } | 167 | } |
157 | else | 168 | else |
@@ -195,6 +206,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
195 | { | 206 | { |
196 | { | 207 | { |
197 | RemoveXferData(xferID); | 208 | RemoveXferData(xferID); |
209 | RemoveOrDecrement(dl.FileName); | ||
198 | } | 210 | } |
199 | } | 211 | } |
200 | else | 212 | else |
@@ -226,8 +238,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
226 | xferItem.DataPointer = 0; | 238 | xferItem.DataPointer = 0; |
227 | 239 | ||
228 | // If the abort comes in | 240 | // If the abort comes in |
229 | if (NewFiles.ContainsKey(xferItem.FileName)) | ||
230 | NewFiles.Remove(xferItem.FileName); | ||
231 | 241 | ||
232 | if (Requests.ContainsKey(xferItem.FileName)) | 242 | if (Requests.ContainsKey(xferItem.FileName)) |
233 | Requests.Remove(xferItem.FileName); | 243 | Requests.Remove(xferItem.FileName); |
@@ -239,10 +249,26 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
239 | { | 249 | { |
240 | lock (NewFiles) | 250 | lock (NewFiles) |
241 | { | 251 | { |
252 | if (Transfers.ContainsKey(xferID)) | ||
253 | RemoveOrDecrement(Transfers[xferID].FileName); | ||
254 | |||
242 | RemoveXferData(xferID); | 255 | RemoveXferData(xferID); |
243 | } | 256 | } |
244 | } | 257 | } |
245 | 258 | ||
259 | private void RemoveOrDecrement(string fileName) | ||
260 | { | ||
261 | // NewFiles must be locked | ||
262 | |||
263 | if (NewFiles.ContainsKey(fileName)) | ||
264 | { | ||
265 | if (NewFiles[fileName].Count == 1) | ||
266 | NewFiles.Remove(fileName); | ||
267 | else | ||
268 | NewFiles[fileName].Count--; | ||
269 | } | ||
270 | } | ||
271 | |||
246 | #region Nested type: XferDownLoad | 272 | #region Nested type: XferDownLoad |
247 | 273 | ||
248 | public class XferDownLoad | 274 | public class XferDownLoad |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 80adc46..a3e3b4e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -620,8 +620,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
620 | } | 620 | } |
621 | catch (WebException e) | 621 | catch (WebException e) |
622 | { | 622 | { |
623 | m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", | 623 | m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0} the host didn't respond " + e.ToString(), reginfo.ServerURI.ToString()); |
624 | reginfo.ServerURI, e.Message); | ||
625 | } | 624 | } |
626 | 625 | ||
627 | return false; | 626 | return false; |