Skip to content

Commit

Permalink
Added cancel/status functions to http download manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ccw808 committed Oct 21, 2018
1 parent 96f4c0e commit ec96f52
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Client/version.h
Expand Up @@ -72,7 +72,7 @@

#define _ASE_VERSION QUOTE_DEFINE(MTASA_VERSION_MAJOR) "." QUOTE_DEFINE(MTASA_VERSION_MINOR)
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
#define _CLIENT_NET_MODULE_VERSION 0x0A9 // (0x000 - 0xfff) Lvl9 wizards only
#define _CLIENT_NET_MODULE_VERSION 0x0AA // (0x000 - 0xfff) Lvl9 wizards only
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)
#define MTA_DM_BITSTREAM_VERSION 0x06C // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).

Expand Down
2 changes: 1 addition & 1 deletion Server/version.h
Expand Up @@ -75,7 +75,7 @@

#define _ASE_VERSION QUOTE_DEFINE(MTASA_VERSION_MAJOR) "." QUOTE_DEFINE(MTASA_VERSION_MINOR)
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
#define _SERVER_NET_MODULE_VERSION 0x0A9 // (0x000 - 0xfff) Lvl9 wizards only
#define _SERVER_NET_MODULE_VERSION 0x0AA // (0x000 - 0xfff) Lvl9 wizards only
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)
#define MTA_DM_BITSTREAM_VERSION 0x06C // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).

Expand Down
11 changes: 11 additions & 0 deletions Shared/sdk/net/CNetHTTPDownloadManagerInterface.h
Expand Up @@ -143,6 +143,13 @@ inline SHttpRequestOptionsTx::SHttpRequestOptionsTx(const SHttpRequestOptions& i
strPassword = in.strPassword;
}

struct SDownloadStatus
{
uint uiAttemptNumber; // 0=Queued 1+=Downloading
uint uiContentLength; // Item total size. Will be 0 if http header 'Content-Length' is missing
uint uiBytesReceived; // Download progress
};

// PFN_DOWNLOAD_FINISHED_CALLBACK is called once at the end of the download.
// If bSuccess is true, then pData+dataSize will be set or the output file will be ready.
// If bSuccess is false, then iErrorCode and CNetHTTPDownloadManagerInterface->GetError() will reveal the problem.
Expand Down Expand Up @@ -174,4 +181,8 @@ class CNetHTTPDownloadManagerInterface
virtual void SetMaxConnections(int iMaxConnections) = 0;

virtual void Reset(void) = 0;

// objectPtr and pfnDownloadFinishedCallback are used to identify the download and should be the same as when QueueFile was originally called
virtual bool CancelDownload(void* objectPtr, PFN_DOWNLOAD_FINISHED_CALLBACK pfnDownloadFinishedCallback) = 0;
virtual bool GetDownloadStatus(void* objectPtr, PFN_DOWNLOAD_FINISHED_CALLBACK pfnDownloadFinishedCallback, SDownloadStatus& outDownloadStatus) = 0;
};

0 comments on commit ec96f52

Please sign in to comment.