diff options
author | Melanie | 2009-10-26 04:52:11 +0000 |
---|---|---|
committer | Melanie | 2009-10-26 04:52:11 +0000 |
commit | 7df54d4ad2b874eed0e93f13a6bdc06cccf2077e (patch) | |
tree | f9bcf09915c3631d44be5a62faaa26fbfac35f62 | |
parent | Added a missing reference to System.Core for OpenSim.Region.Framework (diff) | |
download | opensim-SC-7df54d4ad2b874eed0e93f13a6bdc06cccf2077e.zip opensim-SC-7df54d4ad2b874eed0e93f13a6bdc06cccf2077e.tar.gz opensim-SC-7df54d4ad2b874eed0e93f13a6bdc06cccf2077e.tar.bz2 opensim-SC-7df54d4ad2b874eed0e93f13a6bdc06cccf2077e.tar.xz |
Thank you, RemedyTomm, for a patch to handle Xfer requests being dropped
before the file data to be transfered is ready.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 834aa14..d275b7f 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | |||
@@ -40,6 +40,12 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
40 | private Scene m_scene; | 40 | private Scene m_scene; |
41 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 41 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); |
42 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 42 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
43 | public Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); | ||
44 | public struct XferRequest | ||
45 | { | ||
46 | public IClientAPI remoteClient; | ||
47 | public ulong xferID; | ||
48 | } | ||
43 | 49 | ||
44 | #region IRegionModule Members | 50 | #region IRegionModule Members |
45 | 51 | ||
@@ -86,6 +92,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
86 | NewFiles.Add(fileName, data); | 92 | NewFiles.Add(fileName, data); |
87 | } | 93 | } |
88 | } | 94 | } |
95 | |||
96 | if (Requests.ContainsKey(fileName)) | ||
97 | { | ||
98 | RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName); | ||
99 | Requests.Remove(fileName); | ||
100 | } | ||
101 | |||
89 | return true; | 102 | return true; |
90 | } | 103 | } |
91 | 104 | ||
@@ -105,7 +118,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
105 | /// <param name="fileName"></param> | 118 | /// <param name="fileName"></param> |
106 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) | 119 | public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) |
107 | { | 120 | { |
108 | |||
109 | lock (NewFiles) | 121 | lock (NewFiles) |
110 | { | 122 | { |
111 | if (NewFiles.ContainsKey(fileName)) | 123 | if (NewFiles.ContainsKey(fileName)) |
@@ -114,6 +126,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
114 | { | 126 | { |
115 | byte[] fileData = NewFiles[fileName]; | 127 | byte[] fileData = NewFiles[fileName]; |
116 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); | 128 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); |
129 | |||
117 | Transfers.Add(xferID, transaction); | 130 | Transfers.Add(xferID, transaction); |
118 | NewFiles.Remove(fileName); | 131 | NewFiles.Remove(fileName); |
119 | 132 | ||
@@ -123,6 +136,16 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
123 | } | 136 | } |
124 | } | 137 | } |
125 | } | 138 | } |
139 | else | ||
140 | { | ||
141 | if (!Requests.ContainsKey(fileName)) | ||
142 | { | ||
143 | XferRequest nRequest = new XferRequest(); | ||
144 | nRequest.remoteClient = remoteClient; | ||
145 | nRequest.xferID = xferID; | ||
146 | Requests.Add(fileName, nRequest); | ||
147 | } | ||
148 | } | ||
126 | } | 149 | } |
127 | } | 150 | } |
128 | 151 | ||
@@ -177,7 +200,6 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
177 | Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4); | 200 | Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4); |
178 | Array.Copy(Data, 0, transferData, 4, Data.Length); | 201 | Array.Copy(Data, 0, transferData, 4, Data.Length); |
179 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); | 202 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); |
180 | |||
181 | complete = true; | 203 | complete = true; |
182 | } | 204 | } |
183 | else | 205 | else |