diff options
author | MW | 2008-12-12 22:20:13 +0000 |
---|---|---|
committer | MW | 2008-12-12 22:20:13 +0000 |
commit | e0765fa6c8fbcb385802d194a7bf08b4e686553a (patch) | |
tree | 36e9e8899b1b6d512c064e76798267fed654fa95 /OpenSim/Region | |
parent | * minor: Downgrade friends module 'client logging out' notice from error to d... (diff) | |
download | opensim-SC-e0765fa6c8fbcb385802d194a7bf08b4e686553a.zip opensim-SC-e0765fa6c8fbcb385802d194a7bf08b4e686553a.tar.gz opensim-SC-e0765fa6c8fbcb385802d194a7bf08b4e686553a.tar.bz2 opensim-SC-e0765fa6c8fbcb385802d194a7bf08b4e686553a.tar.xz |
more work on moving FileTransfer code to the clientstack.
Although its still not enabled.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs index b2e7bc4..5526a16 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs | |||
@@ -17,6 +17,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
17 | { | 17 | { |
18 | protected IClientAPI m_clientAPI; | 18 | protected IClientAPI m_clientAPI; |
19 | 19 | ||
20 | /// Dictionary of handlers for uploading files from client | ||
21 | /// TODO: Need to add cleanup code to remove handlers that have completed their upload | ||
20 | protected Dictionary<ulong, XferHandler> m_handlers; | 22 | protected Dictionary<ulong, XferHandler> m_handlers; |
21 | protected object m_handlerLock = new object(); | 23 | protected object m_handlerLock = new object(); |
22 | 24 | ||
@@ -47,6 +49,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
47 | } | 49 | } |
48 | 50 | ||
49 | XferHandler uploader = new XferHandler(m_clientAPI, clientFileName); | 51 | XferHandler uploader = new XferHandler(m_clientAPI, clientFileName); |
52 | |||
53 | return StartUpload(uploader, uploadCompleteCallback, abortCallback); | ||
54 | } | ||
55 | |||
56 | public bool RequestUpload(UUID fileID, UploadComplete uploadCompleteCallback, UploadAborted abortCallback) | ||
57 | { | ||
58 | if ((fileID == UUID.Zero) || (uploadCompleteCallback == null)) | ||
59 | { | ||
60 | return false; | ||
61 | } | ||
62 | |||
63 | XferHandler uploader = new XferHandler(m_clientAPI, fileID); | ||
64 | |||
65 | return StartUpload(uploader, uploadCompleteCallback, abortCallback); | ||
66 | } | ||
67 | |||
68 | private bool StartUpload(XferHandler uploader, UploadComplete uploadCompleteCallback, UploadAborted abortCallback) | ||
69 | { | ||
50 | uploader.UploadDone += uploadCompleteCallback; | 70 | uploader.UploadDone += uploadCompleteCallback; |
51 | 71 | ||
52 | if (abortCallback != null) | 72 | if (abortCallback != null) |
@@ -133,6 +153,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
133 | mXferID = Util.GetNextXferID(); | 153 | mXferID = Util.GetNextXferID(); |
134 | } | 154 | } |
135 | 155 | ||
156 | public XferHandler(IClientAPI pRemoteClient, UUID fileID) | ||
157 | { | ||
158 | m_asset = new AssetBase(); | ||
159 | m_asset.FullID = fileID; | ||
160 | m_asset.Type = type; | ||
161 | m_asset.Data = new byte[0]; | ||
162 | m_asset.Name = null; | ||
163 | m_asset.Description = "empty"; | ||
164 | m_asset.Local = true; | ||
165 | m_asset.Temporary = true; | ||
166 | mXferID = Util.GetNextXferID(); | ||
167 | } | ||
168 | |||
136 | public ulong XferID | 169 | public ulong XferID |
137 | { | 170 | { |
138 | get { return mXferID; } | 171 | get { return mXferID; } |
@@ -140,7 +173,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
140 | 173 | ||
141 | public void RequestStartXfer(IClientAPI pRemoteClient) | 174 | public void RequestStartXfer(IClientAPI pRemoteClient) |
142 | { | 175 | { |
143 | pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); | 176 | if (m_asset.Name != null) |
177 | { | ||
178 | pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); | ||
183 | } | ||
144 | } | 184 | } |
145 | 185 | ||
146 | /// <summary> | 186 | /// <summary> |
@@ -183,7 +223,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
183 | handlerUploadDone = UploadDone; | 223 | handlerUploadDone = UploadDone; |
184 | if (handlerUploadDone != null) | 224 | if (handlerUploadDone != null) |
185 | { | 225 | { |
186 | handlerUploadDone(m_asset.Name, m_asset.Data, remoteClient); | 226 | handlerUploadDone(m_asset.Name, m_asset.FullID, m_asset.Data, remoteClient); |
187 | } | 227 | } |
188 | } | 228 | } |
189 | 229 | ||