📄 updownclient.h
字号:
CFriend* m_Friend;
uint8* m_abyUpPartStatus;
CTypedPtrList<CPtrList, CPartFile*> m_OtherRequests_list;
CTypedPtrList<CPtrList, CPartFile*> m_OtherNoNeeded_list;
uint16 m_lastPartAsked;
bool m_bAddNextConnect;
void SetSlotNumber(uint32 newValue) { m_slotNumber = newValue; }
uint32 GetSlotNumber() const { return m_slotNumber; }
CEMSocket* GetFileUploadSocket(bool log = false);
///////////////////////////////////////////////////////////////////////////
// PeerCache client
//
bool IsDownloadingFromPeerCache() const;
bool IsUploadingToPeerCache() const;
void SetPeerCacheDownState(EPeerCacheDownState eState);
void SetPeerCacheUpState(EPeerCacheUpState eState);
int GetHttpSendState() const { return m_iHttpSendState; }
void SetHttpSendState(int iState) { m_iHttpSendState = iState; }
bool SendPeerCacheFileRequest();
bool ProcessPeerCacheQuery(const char* packet, UINT size);
bool ProcessPeerCacheAnswer(const char* packet, UINT size);
bool ProcessPeerCacheAcknowledge(const char* packet, UINT size);
void OnPeerCacheDownSocketClosed(int nErrorCode);
bool OnPeerCacheDownSocketTimeout();
bool ProcessPeerCacheDownHttpResponse(const CStringAArray& astrHeaders);
bool ProcessPeerCacheDownHttpResponseBody(const BYTE* pucData, UINT uSize);
bool ProcessPeerCacheUpHttpResponse(const CStringAArray& astrHeaders);
UINT ProcessPeerCacheUpHttpRequest(const CStringAArray& astrHeaders);
virtual bool ProcessHttpDownResponse(const CStringAArray& astrHeaders);
virtual bool ProcessHttpDownResponseBody(const BYTE* pucData, UINT uSize);
CPeerCacheDownSocket* m_pPCDownSocket;
CPeerCacheUpSocket* m_pPCUpSocket;
protected:
int m_iHttpSendState;
uint32 m_uPeerCacheDownloadPushId;
uint32 m_uPeerCacheUploadPushId;
uint32 m_uPeerCacheRemoteIP;
bool m_bPeerCacheDownHit;
bool m_bPeerCacheUpHit;
EPeerCacheDownState m_ePeerCacheDownState;
EPeerCacheUpState m_ePeerCacheUpState;
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;
//--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;
//--group to aligned int32
bool m_bUnicodeSupport;
bool m_bBuddyIDValid;
uint16 m_nBuddyPort;
//--group to aligned int32
uint32 m_nBuddyIP;
uint32 m_dwLastBuddyPingPongTime;
uchar m_achBuddyID[16];
CString m_strHelloInfo;
CString m_strMuleInfo;
uint8 m_byKadVersion;
// 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> m_DontSwap_list;
////////////////////////////////////////////////////////////////////////
// Upload
//
int GetFilePrioAsNumber() const;
uint32 m_nTransferredUp;
uint32 m_dwUploadTime;
uint32 m_cAsked;
uint32 m_dwLastUpRequest;
uint32 m_nCurSessionUp;
uint32 m_nCurSessionDown;
uint32 m_nCurQueueSessionPayloadUp;
uint32 m_addedPayloadQueueSession;
uint16 m_nUpPartCount;
uint16 m_nUpCompleteSourcesCount;
uchar requpfileid[16];
uint32 m_slotNumber;
typedef struct TransferredData {
uint32 datalen;
DWORD timestamp;
};
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;
CAICHHash* m_pReqFileAICHHash;
uint32 m_cDownAsked;
uint8* m_abyPartStatus;
CString m_strClientFilename;
uint32 m_nTransferredDown;
uint32 m_dwDownStartTime;
uint32 m_nLastBlockOffset;
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;
// Download from URL
CStringA m_strUrlPath;
UINT m_uReqStart;
UINT m_uReqEnd;
UINT m_nUrlStartPos;
//////////////////////////////////////////////////////////
// Upload data rate computation
//
uint32 m_nUpDatarate;
uint32 m_nSumForAvgUpDataRate;
CList<TransferredData> m_AvarageUDR_list;
//////////////////////////////////////////////////////////
// Download data rate computation
//
uint32 m_nDownDatarate;
uint32 m_nDownDataRateMS;
uint32 m_nSumForAvgDownDataRate;
CList<TransferredData> m_AvarageDDR_list;
//////////////////////////////////////////////////////////
// GUI helpers
//
static CBarShader s_StatusBar;
static CBarShader s_UpStatusBar;
DWORD m_lastRefreshedDLDisplay;
DWORD m_lastRefreshedULDisplay;
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,
m_fSentOutOfPartReqs : 1;
CTypedPtrList<CPtrList, Pending_Block_Struct*> m_PendingBlocks_list;
CTypedPtrList<CPtrList, Requested_Block_Struct*> m_DownloadBlocks_list;
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
};
//#pragma pack()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -