Fix streaming HTTP response header and data callbacks
This commit is contained in:
+20
-1
@@ -21,6 +21,10 @@
|
||||
#include "steam_gameserver.h"
|
||||
#include "smsdk_ext.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class SteamWorksHTTPRequest;
|
||||
|
||||
class SteamWorksHTTP :
|
||||
public IHandleTypeDispatch
|
||||
{
|
||||
@@ -31,12 +35,27 @@ class SteamWorksHTTP :
|
||||
public:
|
||||
void OnHandleDestroy(HandleType_t type, void *object);
|
||||
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
||||
|
||||
|
||||
public:
|
||||
HandleType_t GetHTTPHandle(void);
|
||||
|
||||
/* Streaming responses report progress through HTTPRequestHeadersReceived_t /
|
||||
HTTPRequestDataReceived_t. Steam delivers those as broadcast gameserver
|
||||
callbacks (not as call results of the streaming API call), so a single
|
||||
dispatcher here receives them and routes each one to the owning request by
|
||||
its handle. Requests add/remove themselves as they are created/destroyed. */
|
||||
void RegisterRequest(SteamWorksHTTPRequest *pRequest);
|
||||
void UnregisterRequest(SteamWorksHTTPRequest *pRequest);
|
||||
|
||||
private:
|
||||
SteamWorksHTTPRequest *FindRequest(HTTPRequestHandle request);
|
||||
|
||||
STEAM_GAMESERVER_CALLBACK(SteamWorksHTTP, OnHTTPHeadersReceived, HTTPRequestHeadersReceived_t, m_CallbackHeadersReceived);
|
||||
STEAM_GAMESERVER_CALLBACK(SteamWorksHTTP, OnHTTPDataReceived, HTTPRequestDataReceived_t, m_CallbackDataReceived);
|
||||
|
||||
private:
|
||||
HandleType_t typeHTTP;
|
||||
std::unordered_map<HTTPRequestHandle, SteamWorksHTTPRequest *> m_Requests;
|
||||
};
|
||||
|
||||
#include "swhttprequest.h"
|
||||
|
||||
Reference in New Issue
Block a user