📄 updownclient.h
字号:
}
// A4AF Stats Stuff:
// In CPartFile::Process, I am going to keep a tally of how many clients
// in that PF's source list are A4AF for other files. This tally is worthless
// to the PartFile that it belongs to, but when we add all of these counts up for
// each PartFile, we will get an accurate count of how many A4AF requests there are
// total. This is for the Found Sources section of the tree. This is a better, faster
// option than looping through the lists for unavailable sources.
uint16 GetA4AFCount() const
{
return m_OtherRequests_list.GetCount();
}
// <-----khaos-
uint16 GetUpCompleteSourcesCount() const
{
return m_nUpCompleteSourcesCount;
}
void SetUpCompleteSourcesCount(uint16 n)
{
m_nUpCompleteSourcesCount = n;
}
//chat
EChatState GetChatState() const
{
return (EChatState)m_nChatstate;
}
void SetChatState(EChatState nNewS)
{
m_nChatstate = nNewS;
}
//KadIPCheck
EKadState GetKadState() const
{
return (EKadState)m_nKadState;
}
void SetKadState(EKadState nNewS)
{
m_nKadState = nNewS;
}
//File Comment
bool HasFileComment() const { return !m_strFileComment.IsEmpty(); }
const CString& GetFileComment() const { return m_strFileComment; }
void SetFileComment(LPCTSTR pszComment) { m_strFileComment = pszComment; }
bool HasFileRating() const { return m_uFileRating > 0; }
uint8 GetFileRating() const { return m_uFileRating; }
void SetFileRating(uint8 uRating) { m_uFileRating = uRating; }
// Barry - Process zip file as it arrives, don't need to wait until end of block
int unzip(Pending_Block_Struct* block, BYTE* zipped, uint32 lenZipped, BYTE** unzipped, uint32* lenUnzipped, int iRecursion = 0);
void UpdateDisplayedInfo(bool force = false);
int GetFileListRequested() const
{
return m_iFileListRequested;
}
void SetFileListRequested(int iFileListRequested)
{
m_iFileListRequested = iFileListRequested;
}
// message filtering
uint8 GetMessagesReceived() const
{ // count of chatmessages he sent to me
return m_cMessagesReceived;
}
void SetMessagesReceived(uint8 nCount)
{
m_cMessagesReceived = nCount;
}
void IncMessagesReceived()
{
m_cMessagesReceived++;
}
uint8 GetMessagesSent() const
{ // count of chatmessages I sent to him
return m_cMessagesSent;
}
void SetMessagesSent(uint8 nCount)
{
m_cMessagesSent = nCount;
}
void IncMessagesSent()
{
m_cMessagesSent++;
}
bool IsSpammer() const
{
return m_fIsSpammer;
}
void SetSpammer(bool bVal)
{
m_fIsSpammer = bVal ? 1 : 0;
}
bool GetMessageFiltered() const
{
return m_fMessageFiltered;
}
void SetMessageFiltered(bool bVal)
{
m_fMessageFiltered = bVal ? 1 : 0;
}
virtual void SetRequestFile(CPartFile* pReqFile);
CPartFile* GetRequestFile() const {return reqfile;}
// AICH Stuff
void SetReqFileAICHHash(CAICHHash* val);
CAICHHash* GetReqFileAICHHash() const {return m_pReqFileAICHHash;}
bool IsSupportingAICH() const {return m_fSupportsAICH & 0x01;}
void SendAICHRequest(CPartFile* pForFile, uint16 nPart);
bool IsAICHReqPending() const {return m_fAICHRequested; }
void ProcessAICHAnswer(char* packet, UINT size);
void ProcessAICHRequest(char* packet, UINT size);
void ProcessAICHFileHash(CSafeMemFile* data, CPartFile* file);
EUtf8Str GetUnicodeSupport() const;
CString GetDownloadStateDisplayString() const;
CString GetUploadStateDisplayString() const;
LPCTSTR DbgGetDownloadState() const;
LPCTSTR DbgGetUploadState() const;
CString DbgGetClientInfo(bool bFormatIP = false) const;
CString DbgGetFullClientSoftVer() const;
const CString& DbgGetHelloInfo() const { return m_strHelloInfo; }
const CString& DbgGetMuleInfo() const { return m_strMuleInfo; }
// ZZ:DownloadManager -->
const bool IsInNoNeededList(const CPartFile* fileToCheck) const;
const bool SwapToRightFile(CPartFile* SwapTo, CPartFile* cur_file, bool ignoreSuspensions, bool SwapToIsNNPFile, bool isNNPFile, bool& wasSkippedDueToSourceExchange, bool doAgressiveSwapping = false, bool debug = false);
const DWORD getLastTriedToConnectTime() { return m_dwLastTriedToConnect; }
// <-- ZZ:DownloadManager
#ifdef _DEBUG
// Diagnostic Support
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
CClientReqSocket* socket;
CClientCredits* credits;
CFriend* m_Friend;
uint8* m_abyUpPartStatus;
CTypedPtrList<CPtrList, CPartFile*> m_OtherRequests_list;
CTypedPtrList<CPtrList, CPartFile*> m_OtherNoNeeded_list;
uint16 m_lastPartAsked;
bool m_bAddNextConnect; // VQB Fix for LowID slots only on connection
void SetSlotNumber(uint32 newValue) { m_slotNumber = newValue; }
uint32 GetSlotNumber() const { return m_slotNumber; }
CEMSocket* GetFileUploadSocket(bool log = false);
protected:
// base
void Init();
bool ProcessHelloTypePacket(CSafeMemFile* data);
void SendHelloTypePacket(CSafeMemFile* data);
void CreateStandartPackets(byte* data,uint32 togo, Requested_Block_Struct* currentblock, bool bFromPF = true);
void CreatePackedPackets(byte* data,uint32 togo, Requested_Block_Struct* currentblock, bool bFromPF = true);
uint32 m_nConnectIP; // holds the supposed IP or (after we had a connection) the real IP
uint32 m_dwUserIP; // holds 0 (real IP not yet available) or the real IP (after we had a connection)
uint32 m_dwServerIP;
uint32 m_nUserIDHybrid;
uint16 m_nUserPort;
uint16 m_nServerPort;
uint32 m_nClientVersion;
uint32 m_nUpDatarate;
uint32 dataratems;
//--group to aligned int32
uint8 m_byEmuleVersion;
uint8 m_byDataCompVer;
bool m_bEmuleProtocol;
bool m_bIsHybrid;
//--group to aligned int32
TCHAR* m_pszUsername;
uchar m_achUserHash[16];
uint16 m_nUDPPort;
uint16 m_nKadPort;
//--group to aligned int32
uint8 m_byUDPVer;
uint8 m_bySourceExchangeVer;
uint8 m_byAcceptCommentVer;
uint8 m_byExtendedRequestsVer;
//--group to aligned int32
uint8 m_byCompatibleClient;
bool m_bFriendSlot;
bool m_bCommentDirty;
bool m_bIsML;
//--group to aligned int32
bool m_bGPLEvildoer;
bool m_bHelloAnswerPending;
uint8 m_byInfopacketsReceived; // have we received the edonkeyprot and emuleprot packet already (see InfoPacketsReceived() )
uint8 m_bySupportSecIdent;
//--group to aligned int32
uint32 m_dwLastSignatureIP;
CString m_strClientSoftware;
CString m_strModVersion;
uint32 m_dwLastSourceRequest;
uint32 m_dwLastSourceAnswer;
uint32 m_dwLastAskedForSources;
int m_iFileListRequested;
CString m_strFileComment;
//--group to aligned int32
uint8 m_uFileRating;
uint8 m_cMessagesReceived; // count of chatmessages he sent to me
uint8 m_cMessagesSent; // count of chatmessages I sent to him
bool m_bMultiPacket;
// states
#ifdef _DEBUG
// use the 'Enums' only for debug builds, each enum costs 4 bytes (3 unused)
EClientSoftware m_clientSoft;
EChatState m_nChatstate;
EKadState m_nKadState;
ESecureIdentState m_SecureIdentState;
EUploadState m_nUploadState;
EDownloadState m_nDownloadState;
ESourceFrom m_nSourceFrom;
#else
uint8 m_clientSoft;
uint8 m_nChatstate;
uint8 m_nKadState;
uint8 m_SecureIdentState;
uint8 m_nUploadState;
uint8 m_nDownloadState;
uint8 m_nSourceFrom;
#endif
CTypedPtrList<CPtrList, Packet*> m_WaitingPackets_list;
CList<PartFileStamp, PartFileStamp> m_DontSwap_list;
DWORD m_lastRefreshedDLDisplay;
DWORD m_lastRefreshedULDisplay;
////////////////////////////////////////////////////////////////////////
//upload
int CUpDownClient::GetFilePrioAsNumber() const;
uint32 m_nTransferedUp;
uint32 m_dwUploadTime;
uint32 m_cAsked;
uint32 m_dwLastUpRequest;
uint32 m_nCurSessionUp;
uint32 m_nCurQueueSessionPayloadUp;
uint32 m_addedPayloadQueueSession;
uint16 m_nUpPartCount;
uint16 m_nUpCompleteSourcesCount;
static CBarShader s_UpStatusBar;
uchar requpfileid[16];
uint32 m_slotNumber;
typedef struct TransferredData {
uint32 datalen;
DWORD timestamp;
};
CList<TransferredData,TransferredData> m_AvarageUDR_list; // By BadWolf
CTypedPtrList<CPtrList, Requested_Block_Struct*> m_BlockRequests_queue;
CTypedPtrList<CPtrList, Requested_Block_Struct*> m_DoneBlocks_list;
CTypedPtrList<CPtrList, Requested_File_Struct*> m_RequestedFiles_list;
//////////////////////////////////////////////////////////
//download
CPartFile* reqfile;
uint32 m_cDownAsked;
uint8* m_abyPartStatus;
CString m_strClientFilename;
uint32 m_nTransferedDown;
// -khaos--+++> Download Session Stats
uint32 m_dwDownStartTime;
// <-----khaos-
uint32 m_nLastBlockOffset; // Patch for show parts that you download [Cax2]
uint32 m_nDownDatarate;
uint32 m_nDownDataRateMS;
uint32 m_nSumForAvgDownDataRate;
uint32 m_dwLastBlockReceived;
uint32 m_nTotalUDPPackets;
uint32 m_nFailedUDPPackets;
//--group to aligned int32
uint16 m_cShowDR;
uint16 m_nRemoteQueueRank;
//--group to aligned int32
uint16 m_nPartCount;
bool m_bRemoteQueueFull;
bool m_bCompleteSource;
//--group to aligned int32
bool m_bReaskPending;
bool m_bUDPPending;
bool m_bTransferredDownMini;
bool m_bUnicodeSupport;
//--group to aligned int32
uint32 m_nBuddyIP;
uint16 m_nBuddyPort;
bool m_bBuddyIDValid;
uchar m_achBuddyID[16];
static CBarShader s_StatusBar;
CAICHHash* m_pReqFileAICHHash;
uint32 m_random_update_wait;
// using bitfield for less important flags, to save some bytes
UINT m_fHashsetRequesting : 1, // we have sent a hashset request to this client in the current connection
m_fSharedDirectories : 1, // client supports OP_ASKSHAREDIRS opcodes
m_fSentCancelTransfer: 1, // we have sent an OP_CANCELTRANSFER in the current connection
m_fNoViewSharedFiles : 1, // client has disabled the 'View Shared Files' feature, if this flag is not set, we just know that we don't know for sure if it is enabled
m_fSupportsPreview : 1,
m_fPreviewReqPending : 1,
m_fPreviewAnsPending : 1,
m_fIsSpammer : 1,
m_fMessageFiltered : 1,
m_fPeerCache : 1,
m_fQueueRankPending : 1,
m_fUnaskQueueRankRecv: 2,
m_fFailedFileIdReqs : 4, // nr. of failed file-id related requests per connection
m_fNeedOurPublicIP : 1, // we requested our IP from this client
m_fSupportsAICH : 3,
m_fAICHRequested : 1;
// By BadWolf - Accurate Speed Measurement (Ottavio84 idea)
CList<TransferredData,TransferredData> m_AvarageDDR_list;
uint32 sumavgUDR;
// END By BadWolf - Accurate Speed Measurement (Ottavio84 idea)
CTypedPtrList<CPtrList, Pending_Block_Struct*> m_PendingBlocks_list;
CTypedPtrList<CPtrList, Requested_Block_Struct*> m_DownloadBlocks_list;
CString m_strHelloInfo;
CString m_strMuleInfo;
CStringA m_strUrlPath;
UINT m_uReqStart;
UINT m_uReqEnd;
UINT m_nUrlStartPos;
bool m_bSourceExchangeSwapped; // ZZ:DownloadManager
DWORD lastSwapForSourceExchangeTick; // ZZ:DownloadManaager
bool DoSwap(CPartFile* SwapTo, bool bRemoveCompletely, LPCTSTR reason); // ZZ:DownloadManager
CMap<CPartFile*, CPartFile*, DWORD, DWORD> m_fileReaskTimes; // ZZ:DownloadManager (one resk timestamp for each file)
DWORD m_dwLastTriedToConnect; // ZZ:DownloadManager (one resk timestamp for each file)
bool RecentlySwappedForSourceExchange() { return ::GetTickCount()-lastSwapForSourceExchangeTick < 30*1000; } // ZZ:DownloadManager
void SetSwapForSourceExchangeTick() { lastSwapForSourceExchangeTick = ::GetTickCount(); } // ZZ:DownloadManager
//EastShare Start - added by AndCycle, IP to Country
public:
CString GetCountryName(bool longName = false) const;
int GetCountryFlagIndex() const;
void ResetIP2Country();
private:
struct IPRange_Struct2* m_structUserCountry; //EastShare - added by AndCycle, IP to Country
//EastShare End - added by AndCycle, IP to Country
private: //VeryCD
CList<sint64> scoreAdjustor;
public:
void updateScoreAdjustor(void);
};
//#pragma pack()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -