ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <connectionmanager.h>

Inheritance diagram for Networking::ConnectionManager:
Collaboration diagram for Networking::ConnectionManager:

List of all members.

Classes

struct  RequestWithCallback
 RequestWithCallback is used by ConnectionManager to storage the Request and a callback which should be called on Request delete. More...

Public Member Functions

 ConnectionManager ()
virtual ~ConnectionManager ()
void registerEasyHandle (CURL *easy) const
 All libcurl transfers are going through this ConnectionManager.
RequestaddRequest (Request *request, RequestCallback callback=nullptr)
 Use this method to add new Request into manager's queue.
Common::String urlEncode (Common::String s) const
 Return URL-encoded version of given string.

Static Public Member Functions

static uint32 getCloudRequestsPeriodInMicroseconds ()

Private Types

typedef Common::BaseCallback
< Request * > * 
RequestCallback

Private Member Functions

void startTimer (int interval=TIMER_INTERVAL)
void stopTimer ()
void handle ()
void interateRequests ()
void processTransfers ()
bool hasAddedRequests ()

Private Attributes

CURLM_multi
bool _timerStarted
Common::Array
< RequestWithCallback
_requests
Common::Array
< RequestWithCallback
_addedRequests
Common::Mutex _handleMutex
Common::Mutex _addedRequestsMutex
uint32 _frame

Static Private Attributes

static const uint32 FRAMES_PER_SECOND = 20
static const uint32 TIMER_INTERVAL = 1000000 / FRAMES_PER_SECOND
static const uint32 CLOUD_PERIOD = 20
static const uint32 CURL_PERIOD = 1

Friends

void connectionsThread (void *)

Detailed Description

Definition at line 40 of file connectionmanager.h.


Member Typedef Documentation


Constructor & Destructor Documentation

Networking::ConnectionManager::ConnectionManager (  ) 

Definition at line 40 of file connectionmanager.cpp.

Networking::ConnectionManager::~ConnectionManager (  )  [virtual]

Definition at line 45 of file connectionmanager.cpp.


Member Function Documentation

Request * Networking::ConnectionManager::addRequest ( Request request,
RequestCallback  callback = nullptr 
)

Use this method to add new Request into manager's queue.

Manager will periodically call handle() method of these Requests until they set their state to FINISHED.

If Request's state is RETRY, handleRetry() is called instead.

The passed callback would be called after Request is deleted.

Note:
This method starts the timer if it's not started yet.
Returns:
the same Request pointer, just as a shortcut

Definition at line 72 of file connectionmanager.cpp.

uint32 Networking::ConnectionManager::getCloudRequestsPeriodInMicroseconds (  )  [static]

Definition at line 97 of file connectionmanager.cpp.

void Networking::ConnectionManager::handle (  )  [private]

Definition at line 130 of file connectionmanager.cpp.

bool Networking::ConnectionManager::hasAddedRequests (  )  [private]

Definition at line 123 of file connectionmanager.cpp.

void Networking::ConnectionManager::interateRequests (  )  [private]

Definition at line 144 of file connectionmanager.cpp.

void Networking::ConnectionManager::processTransfers (  )  [private]

Definition at line 176 of file connectionmanager.cpp.

void Networking::ConnectionManager::registerEasyHandle ( CURL easy  )  const

All libcurl transfers are going through this ConnectionManager.

So, if you want to start any libcurl transfer, you must create an easy handle and register it using this method.

Definition at line 68 of file connectionmanager.cpp.

void Networking::ConnectionManager::startTimer ( int  interval = TIMER_INTERVAL  )  [private]

Definition at line 107 of file connectionmanager.cpp.

void Networking::ConnectionManager::stopTimer (  )  [private]

Definition at line 116 of file connectionmanager.cpp.

Common::String Networking::ConnectionManager::urlEncode ( Common::String  s  )  const

Return URL-encoded version of given string.

Definition at line 81 of file connectionmanager.cpp.


Friends And Related Function Documentation

void connectionsThread ( void *  ignored  )  [friend]

Definition at line 103 of file connectionmanager.cpp.


Member Data Documentation

Definition at line 81 of file connectionmanager.h.

Definition at line 77 of file connectionmanager.h.

Definition at line 78 of file connectionmanager.h.

Definition at line 43 of file connectionmanager.h.

Definition at line 44 of file connectionmanager.h.

Definition at line 41 of file connectionmanager.h.

Definition at line 42 of file connectionmanager.h.


The documentation for this class was generated from the following files:


Generated on Sat Jan 12 2019 05:04:56 for ResidualVM by doxygen 1.7.1
curved edge   curved edge