a little bit more work on LLFileTransfer.cs, from over the christmas/new year period. Still not working/in use but hopefully I can finish it soon.

0.6.2-post-fixes
MW 2009-01-12 10:16:33 +00:00
parent a7bc56073c
commit e1eb1b2cfa
1 changed files with 11 additions and 7 deletions

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary> /// <summary>
/// Dictionary of files to be sent to clients /// Dictionary of files ready to be sent to clients
/// </summary> /// </summary>
protected static Dictionary<string, byte[]> m_files; protected static Dictionary<string, byte[]> m_files;
@ -71,7 +71,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_clientAPI = clientAPI; m_clientAPI = clientAPI;
m_clientAPI.OnXferReceive += XferReceive; m_clientAPI.OnXferReceive += XferReceive;
m_clientAPI.OnAbortXfer += AbortXferHandler; m_clientAPI.OnAbortXfer += AbortXferUploadHandler;
} }
public void Close() public void Close()
@ -79,11 +79,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_clientAPI != null) if (m_clientAPI != null)
{ {
m_clientAPI.OnXferReceive -= XferReceive; m_clientAPI.OnXferReceive -= XferReceive;
m_clientAPI.OnAbortXfer -= AbortXferHandler; m_clientAPI.OnAbortXfer -= AbortXferUploadHandler;
m_clientAPI = null; m_clientAPI = null;
} }
} }
#region Upload Handling
public bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback) public bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
{ {
if ((String.IsNullOrEmpty(clientFileName)) || (uploadCompleteCallback == null)) if ((String.IsNullOrEmpty(clientFileName)) || (uploadCompleteCallback == null))
@ -111,7 +113,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool StartUpload(XferUploadHandler uploader, UploadComplete uploadCompleteCallback, UploadAborted abortCallback) private bool StartUpload(XferUploadHandler uploader, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
{ {
uploader.UploadDone += uploadCompleteCallback; uploader.UploadDone += uploadCompleteCallback;
uploader.UploadDone += RemoveXferHandler; uploader.UploadDone += RemoveXferUploadHandler;
if (abortCallback != null) if (abortCallback != null)
{ {
@ -130,7 +132,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
// something went wrong with the xferID allocation // something went wrong with the xferID allocation
uploader.UploadDone -= uploadCompleteCallback; uploader.UploadDone -= uploadCompleteCallback;
uploader.UploadDone -= RemoveXferHandler; uploader.UploadDone -= RemoveXferUploadHandler;
if (abortCallback != null) if (abortCallback != null)
{ {
uploader.UploadAborted -= abortCallback; uploader.UploadAborted -= abortCallback;
@ -140,7 +142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
protected void AbortXferHandler(IClientAPI remoteClient, ulong xferID) protected void AbortXferUploadHandler(IClientAPI remoteClient, ulong xferID)
{ {
lock (m_uploadHandlersLock) lock (m_uploadHandlersLock)
{ {
@ -163,10 +165,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
protected void RemoveXferHandler(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient) protected void RemoveXferUploadHandler(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient)
{ {
} }
#endregion
} }
public class XferUploadHandler public class XferUploadHandler