RakNet  4.0
Classes | Public Member Functions | Protected Member Functions | List of all members
RakNet::AutopatcherServer Class Reference

The server plugin for the autopatcher. Must be running for the client to get patches. More...

#include <AutopatcherServer.h>

Inheritance diagram for RakNet::AutopatcherServer:
RakNet::PluginInterface2 RakNet::FileListProgress

Classes

struct  ResultTypeAndBitstream
 

Public Member Functions

void StartThreads (int numThreads, int numSQLConnections, AutopatcherRepositoryInterface **sqlConnectionPtrArray)
 
void CacheMostRecentPatch (const char *applicationName)
 
void SetUploadSendParameters (PacketPriority _priority, char _orderingChannel)
 
void SetFileListTransferPlugin (FileListTransfer *flt)
 
void SetMaxConurrentUsers (unsigned int _maxConcurrentUsers)
 
unsigned int GetMaxConurrentUsers (void) const
 
void SetLoadManagementCallback (AutopatcherServerLoadNotifier *asumc)
 
void SetAllowDownloadOfOriginalUnmodifiedFiles (bool allow)
 
void Clear (void)
 Clear buffered input and output.
 
virtual void OnAttach (void)
 Called when the interface is attached.
 
virtual void OnDetach (void)
 Called when the interface is detached.
 
virtual void Update (void)
 Update is called every time a packet is checked for .
 
virtual PluginReceiveResult OnReceive (Packet *packet)
 
virtual void OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
 
- Public Member Functions inherited from RakNet::PluginInterface2
virtual void OnRakPeerStartup (void)
 Called when RakPeer is initialized.
 
virtual void OnRakPeerShutdown (void)
 Called when RakPeer is shutdown.
 
virtual void OnNewConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, bool isIncoming)
 
virtual void OnFailedConnectionAttempt (Packet *packet, PI2_FailedConnectionAttemptReason failedConnectionAttemptReason)
 
virtual bool UsesReliabilityLayer (void) const
 
virtual void OnDirectSocketSend (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
 
virtual void OnDirectSocketReceive (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
 
virtual void OnReliabilityLayerNotification (const char *errorMessage, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress, bool isError)
 
virtual void OnInternalPacket (InternalPacket *internalPacket, unsigned frameNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time, int isSend)
 
virtual void OnAck (unsigned int messageNumber, SystemAddress remoteSystemAddress, RakNet::TimeMS time)
 
virtual void OnPushBackPacket (const char *data, const BitSize_t bitsUsed, SystemAddress remoteSystemAddress)
 

Protected Member Functions

virtual void OnFilePushesComplete (SystemAddress systemAddress, unsigned short setID)
 This function is called when all files have been read and are being transferred to a remote system.
 
virtual void OnSendAborted (SystemAddress systemAddress)
 This function is called when a send to a system was aborted (probably due to disconnection)
 

Additional Inherited Members

- Private Member Functions inherited from RakNet::FileListProgress
virtual void OnAddFilesFromDirectoryStarted (FileList *fileList, char *dir)
 First callback called when FileList::AddFilesFromDirectory() starts.
 
virtual void OnDirectory (FileList *fileList, char *dir, unsigned int directoriesRemaining)
 Called for each directory, when that directory begins processing.
 
virtual void OnFile (FileList *fileList, char *dir, char *fileName, unsigned int fileSize)
 Called for each file, when that file begins processing.
 
virtual void OnFilePush (const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem, unsigned short setId)
 This function is called when we are sending a file to a remote system.
 
- Private Member Functions inherited from RakNet::IncrementalReadInterface
virtual unsigned int GetFilePart (const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context)
 

Detailed Description

The server plugin for the autopatcher. Must be running for the client to get patches.

Member Function Documentation

void RakNet::AutopatcherServer::CacheMostRecentPatch ( const char *  applicationName)

Load the most recent patch in memory and keep it there This can take a lot of memory, but greatly speeds up serving patches, since disk access is not incurred

Parameters
[in]applicationName0 means all, otherwise the name of the application to cache
unsigned int RakNet::AutopatcherServer::GetMaxConurrentUsers ( void  ) const
Returns
Returns what was passed to SetMaxConurrentUsers();
virtual void RakNet::AutopatcherServer::OnClosedConnection ( const SystemAddress systemAddress,
RakNetGUID  rakNetGUID,
PI2_LostConnectionReason  lostConnectionReason 
)
virtual

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters
[in]systemAddressThe system whose connection was closed
[in]rakNetGuidThe guid of the specified system
[in]lostConnectionReasonHow the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from RakNet::PluginInterface2.

virtual PluginReceiveResult RakNet::AutopatcherServer::OnReceive ( Packet packet)
virtual

OnReceive is called for every packet.

Parameters
[in]packetthe packet that is being returned to the user
Returns
True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from RakNet::PluginInterface2.

void RakNet::AutopatcherServer::SetAllowDownloadOfOriginalUnmodifiedFiles ( bool  allow)

Set whether or not the client can download files that were never modified, that they do not have Defaults to true Set to false to disallow downloading the entire game through the autopatcher. In this case, the user must have a copy of the game through other means (such as a CD install)

Parameters
[in]allowTrue to allow downloading original game files, false to disallow
void RakNet::AutopatcherServer::SetFileListTransferPlugin ( FileListTransfer flt)

This plugin has a dependency on the FileListTransfer plugin, which it uses to actually send the files. So you need an instance of that plugin registered with RakPeerInterface, and a pointer to that interface should be passed here.

Parameters
[in]fltA pointer to a registered instance of FileListTransfer
void RakNet::AutopatcherServer::SetLoadManagementCallback ( AutopatcherServerLoadNotifier *  asumc)

Set a callback to get notifications of when user requests are queued and processed This is primarily of use to load balance the server

Parameters
[in]asumcAn externally allocated instance of AutopatcherServerLoadNotifier. Pass 0 to disable.
void RakNet::AutopatcherServer::SetMaxConurrentUsers ( unsigned int  _maxConcurrentUsers)

This is the maximum number of users the patcher will service at one time (generally about equal to the number of downloads at once) If this limit is exceeded, the request packet will be put into a queue and serviced when slots are available Defaults to 0 (unlimited)

Parameters
[in]maxConcurrentUsersPass 0 for unlimited, otherwise the max users to serve at once
void RakNet::AutopatcherServer::SetUploadSendParameters ( PacketPriority  _priority,
char  _orderingChannel 
)

What parameters to use for the RakPeerInterface::Send() call when uploading files.

Parameters
[in]_prioritySee RakPeerInterface::Send()
[in]_orderingChannelSee RakPeerInterface::Send()
void RakNet::AutopatcherServer::StartThreads ( int  numThreads,
int  numSQLConnections,
AutopatcherRepositoryInterface **  sqlConnectionPtrArray 
)

DO THIS FIRST Implement to start the worker threads. Before this is called, no queries will be performed When this is called, AllocAutopatcherRepositoryInterface will be called with repositoryAllocationParameters The system works in three phases.

  1. Get change list since a given date. This uses one of the worker threads.
  2. If either running a full scan, or files have changed since a given date, get the list of patches. This uses one of the worker threads and does an intensive comparison of the hashes the client has vs. the files in the database
  3. If the total amount of data to be sent exceeds DATABASE_READ_CHUNK_SIZE, defined in the cpp file, then the database will be read from incrementally during this download phase. This uses an sql connection object, which may or may not be also in use by one of the threads. If you have more sql connections than threads, this tends to prevent the same connection from being used to incrementally read files for a downloader, and to be used in a worker thread.
    Parameters
    [in]numThreadsNumber of processing threads, which handles the CPU intensive tasks of generating a patch list and comparing files
    [in]numSQLConnectionsNumber of SQL connection objects passed to sqlConnectionPtrArray. Must be greater than or equal to numThreads
    [in]sqlConnectionPtrArrayList of pointers to AutopatcherRepositoryInterface. C++ note: Don't just cast a derived class array, you need to take the pointer address of each item

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