diff options
author | Adam Frisby | 2008-04-30 21:43:47 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-30 21:43:47 +0000 |
commit | be20f41637b6c06ce3ab16bc25851b6e43468e12 (patch) | |
tree | c41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs | |
parent | * Sometimes you know, you do something really stupid. (diff) | |
download | opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2 opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz |
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs index b609f93..e35b6f5 100644 --- a/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/Xfer/XferModule.cs | |||
@@ -37,15 +37,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
37 | { | 37 | { |
38 | public class XferModule : IRegionModule, IXfer | 38 | public class XferModule : IRegionModule, IXfer |
39 | { | 39 | { |
40 | private Scene m_scene; | ||
40 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); | 41 | public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); |
41 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); | 42 | public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); |
42 | 43 | ||
43 | private Scene m_scene; | ||
44 | |||
45 | public XferModule() | 44 | public XferModule() |
46 | { | 45 | { |
47 | } | 46 | } |
48 | 47 | ||
48 | #region IRegionModule Members | ||
49 | |||
49 | public void Initialise(Scene scene, IConfigSource config) | 50 | public void Initialise(Scene scene, IConfigSource config) |
50 | { | 51 | { |
51 | m_scene = scene; | 52 | m_scene = scene; |
@@ -72,6 +73,28 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
72 | get { return false; } | 73 | get { return false; } |
73 | } | 74 | } |
74 | 75 | ||
76 | #endregion | ||
77 | |||
78 | #region IXfer Members | ||
79 | |||
80 | public bool AddNewFile(string fileName, byte[] data) | ||
81 | { | ||
82 | lock (NewFiles) | ||
83 | { | ||
84 | if (NewFiles.ContainsKey(fileName)) | ||
85 | { | ||
86 | NewFiles[fileName] = data; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | NewFiles.Add(fileName, data); | ||
91 | } | ||
92 | } | ||
93 | return true; | ||
94 | } | ||
95 | |||
96 | #endregion | ||
97 | |||
75 | public void NewClient(IClientAPI client) | 98 | public void NewClient(IClientAPI client) |
76 | { | 99 | { |
77 | client.OnRequestXfer += RequestXfer; | 100 | client.OnRequestXfer += RequestXfer; |
@@ -96,7 +119,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
96 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); | 119 | XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); |
97 | Transfers.Add(xferID, transaction); | 120 | Transfers.Add(xferID, transaction); |
98 | NewFiles.Remove(fileName); | 121 | NewFiles.Remove(fileName); |
99 | 122 | ||
100 | if (transaction.StartSend()) | 123 | if (transaction.StartSend()) |
101 | { | 124 | { |
102 | Transfers.Remove(xferID); | 125 | Transfers.Remove(xferID); |
@@ -119,33 +142,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
119 | } | 142 | } |
120 | } | 143 | } |
121 | 144 | ||
122 | public bool AddNewFile(string fileName, byte[] data) | 145 | #region Nested type: XferDownLoad |
123 | { | ||
124 | lock (NewFiles) | ||
125 | { | ||
126 | if (NewFiles.ContainsKey(fileName)) | ||
127 | { | ||
128 | NewFiles[fileName] = data; | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | NewFiles.Add(fileName, data); | ||
133 | } | ||
134 | } | ||
135 | return true; | ||
136 | } | ||
137 | |||
138 | 146 | ||
139 | public class XferDownLoad | 147 | public class XferDownLoad |
140 | { | 148 | { |
149 | public IClientAPI Client; | ||
150 | private bool complete; | ||
141 | public byte[] Data = new byte[0]; | 151 | public byte[] Data = new byte[0]; |
142 | public string FileName = String.Empty; | ||
143 | public ulong XferID = 0; | ||
144 | public int DataPointer = 0; | 152 | public int DataPointer = 0; |
153 | public string FileName = String.Empty; | ||
145 | public uint Packet = 0; | 154 | public uint Packet = 0; |
146 | public IClientAPI Client; | ||
147 | public uint Serial = 1; | 155 | public uint Serial = 1; |
148 | private bool complete; | 156 | public ulong XferID = 0; |
149 | 157 | ||
150 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) | 158 | public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) |
151 | { | 159 | { |
@@ -172,7 +180,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
172 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); | 180 | Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); |
173 | Array.Copy(Data, 0, transferData, 4, Data.Length); | 181 | Array.Copy(Data, 0, transferData, 4, Data.Length); |
174 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); | 182 | Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); |
175 | 183 | ||
176 | complete = true; | 184 | complete = true; |
177 | } | 185 | } |
178 | else | 186 | else |
@@ -182,10 +190,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
182 | Array.Copy(Data, 0, transferData, 4, 1000); | 190 | Array.Copy(Data, 0, transferData, 4, 1000); |
183 | Client.SendXferPacket(XferID, 0, transferData); | 191 | Client.SendXferPacket(XferID, 0, transferData); |
184 | Packet++; | 192 | Packet++; |
185 | DataPointer = 1000; | 193 | DataPointer = 1000; |
186 | } | 194 | } |
187 | 195 | ||
188 | return complete; | 196 | return complete; |
189 | } | 197 | } |
190 | 198 | ||
191 | /// <summary> | 199 | /// <summary> |
@@ -213,13 +221,15 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer | |||
213 | Client.SendXferPacket(XferID, endPacket, transferData); | 221 | Client.SendXferPacket(XferID, endPacket, transferData); |
214 | Packet++; | 222 | Packet++; |
215 | DataPointer += (Data.Length - DataPointer); | 223 | DataPointer += (Data.Length - DataPointer); |
216 | 224 | ||
217 | complete = true; | 225 | complete = true; |
218 | } | 226 | } |
219 | } | 227 | } |
220 | 228 | ||
221 | return complete; | 229 | return complete; |
222 | } | 230 | } |
223 | } | 231 | } |
232 | |||
233 | #endregion | ||
224 | } | 234 | } |
225 | } \ No newline at end of file | 235 | } \ No newline at end of file |