More work on sending/receiving avatars. Introduces low priority send queue, so that the server send thread is not stalled when sending loads of avatars. Not functional yet.
This commit is contained in:
@@ -21,16 +21,16 @@
|
||||
#ifndef _AVATARMANAGER_H_
|
||||
#define _AVATARMANAGER_H_
|
||||
|
||||
#include <playerdata.h>
|
||||
#include <net/netpacket.h>
|
||||
#include <core/crypthelper.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#define MAX_AVATAR_FILE_SIZE 30720
|
||||
|
||||
struct AvatarFileState;
|
||||
class NetPacket;
|
||||
|
||||
class AvatarManager
|
||||
{
|
||||
@@ -41,14 +41,14 @@ public:
|
||||
|
||||
bool Init(const std::string &dataDir, const std::string &cacheDir);
|
||||
|
||||
boost::shared_ptr<AvatarFileState> OpenAvatarFileForChunkRead(const std::string &fileName, unsigned &outFileSize);
|
||||
boost::shared_ptr<AvatarFileState> OpenAvatarFileForChunkRead(const std::string &fileName, unsigned &outFileSize, AvatarFileType &outFileType);
|
||||
unsigned ChunkReadAvatarFile(boost::shared_ptr<AvatarFileState> fileState, unsigned char *data, unsigned chunkSize);
|
||||
|
||||
bool SendAvatarFile(const std::string &fileName, unsigned requestId, boost::function<void (boost::shared_ptr<NetPacket>)> sender);
|
||||
bool AvatarFileToNetPackets(const std::string &fileName, unsigned requestId, NetPacketList &packets);
|
||||
|
||||
bool GetHashForAvatar(const std::string &fileName, MD5Buf &md5buf);
|
||||
bool GetAvatarFileName(const MD5Buf &md5buf, std::string &fileName) const;
|
||||
bool StoreAvatarInCache(const MD5Buf &md5buf, const std::string &fileExtension, const unsigned char *data, unsigned size);
|
||||
bool StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, unsigned size);
|
||||
|
||||
protected:
|
||||
typedef std::map<MD5Buf, std::string> AvatarMap;
|
||||
|
||||
Reference in New Issue
Block a user