Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Handles transferring files between clients and servers. More...
#include <NetFileTransfer.h>
Classes | |
struct | AsyncFileReceiveTask |
struct | CNetFileSendTask |
Asynchronous file-sending task. More... | |
Public Member Functions | |
CNetFileTransferer (INetSession *session) | |
Status | HandleMessageReceive (const CNetMessage &message) |
Should be called when a message is received from the network. More... | |
void | StartTask (std::function< void(std::string)> task) |
Registers a file-receiving task. More... | |
void | StartResponse (u32 requestID, const std::string &data) |
Registers data to be sent in response to a request. More... | |
void | Poll () |
Call frequently (e.g. More... | |
Private Types | |
using | FileReceiveTasksMap = std::unordered_map< u32, AsyncFileReceiveTask > |
using | FileSendTasksMap = std::map< u32, CNetFileSendTask > |
Private Member Functions | |
Status | OnFileTransferResponse (const CFileTransferResponseMessage &message) |
Status | OnFileTransferData (const CFileTransferDataMessage &message) |
Status | OnFileTransferAck (const CFileTransferAckMessage &message) |
Private Attributes | |
INetSession * | m_Session |
u32 | m_NextRequestID |
FileReceiveTasksMap | m_FileReceiveTasks |
FileSendTasksMap | m_FileSendTasks |
double | m_LastProgressReportTime |
Handles transferring files between clients and servers.
|
private |
|
private |
|
inline |
Status CNetFileTransferer::HandleMessageReceive | ( | const CNetMessage & | message | ) |
Should be called when a message is received from the network.
Returns INFO::SKIPPED if the message is not one that this class handles. Returns INFO::OK if the message is handled successfully, or ERR::FAIL if handled unsuccessfully.
|
private |
|
private |
|
private |
void CNetFileTransferer::Poll | ( | ) |
Call frequently (e.g.
once per frame) to trigger any necessary packet processing.
void CNetFileTransferer::StartResponse | ( | u32 | requestID, |
const std::string & | data | ||
) |
Registers data to be sent in response to a request.
(Callers are expected to have their own mechanism for receiving requests and deciding what to respond with.)
void CNetFileTransferer::StartTask | ( | std::function< void(std::string)> | task | ) |
Registers a file-receiving task.
|
private |
|
private |
|
private |
|
private |
|
private |