本文整理汇总了C++中CKnownFile::UpdatePartsInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ CKnownFile::UpdatePartsInfo方法的具体用法?C++ CKnownFile::UpdatePartsInfo怎么用?C++ CKnownFile::UpdatePartsInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKnownFile
的用法示例。
在下文中一共展示了CKnownFile::UpdatePartsInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveFromUploadQueue
bool CUploadQueue::RemoveFromUploadQueue(CUpDownClient* client, LPCTSTR pszReason, bool updatewindow, bool earlyabort){
bool result = false;
uint32 slotCounter = 1;
for (POSITION pos = uploadinglist.GetHeadPosition();pos != 0;){
POSITION curPos = pos;
CUpDownClient* curClient = uploadinglist.GetNext(pos);
if (client == curClient){
if (updatewindow)
theApp.emuledlg->transferwnd->uploadlistctrl.RemoveClient(client);
if (thePrefs.GetLogUlDlEvents())
AddDebugLogLine(DLP_DEFAULT, true,_T("Removing client from upload list: %s Client: %s Transferred: %s SessionUp: %s QueueSessionPayload: %s In buffer: %s Req blocks: %i File: %s"), pszReason==NULL ? _T("") : pszReason, client->DbgGetClientInfo(), CastSecondsToHM( client->GetUpStartTimeDelay()/1000), CastItoXBytes(client->GetSessionUp(), false, false), CastItoXBytes(client->GetQueueSessionPayloadUp(), false, false), CastItoXBytes(client->GetPayloadInBuffer()), client->GetNumberOfRequestedBlocksInQueue(), (theApp.sharedfiles->GetFileByID(client->GetUploadFileID())?theApp.sharedfiles->GetFileByID(client->GetUploadFileID())->GetFileName():_T("")));
client->m_bAddNextConnect = false;
uploadinglist.RemoveAt(curPos);
bool removed = theApp.uploadBandwidthThrottler->RemoveFromStandardList(client->socket);
bool pcRemoved = theApp.uploadBandwidthThrottler->RemoveFromStandardList((CClientReqSocket*)client->m_pPCUpSocket);
(void)removed;
(void)pcRemoved;
//if(thePrefs.GetLogUlDlEvents() && !(removed || pcRemoved)) {
// AddDebugLogLine(false, _T("UploadQueue: Didn't find socket to delete. Adress: 0x%x"), client->socket);
//}
if(client->GetSessionUp() > 0) {
++successfullupcount;
totaluploadtime += client->GetUpStartTimeDelay()/1000;
} else if(earlyabort == false)
++failedupcount;
CKnownFile* requestedFile = theApp.sharedfiles->GetFileByID(client->GetUploadFileID());
if(requestedFile != NULL) {
requestedFile->UpdatePartsInfo();
}
theApp.clientlist->AddTrackClient(client); // Keep track of this client
client->SetUploadState(US_NONE);
client->ClearUploadBlockRequests();
client->SetCollectionUploadSlot(false);
m_iHighestNumberOfFullyActivatedSlotsSinceLastCall = 0;
result = true;
} else {
curClient->SetSlotNumber(slotCounter);
slotCounter++;
}
}
return result;
}
示例2: ProcessPacket
bool CClientUDPSocket::ProcessPacket(const BYTE* packet, uint16 size, uint8 opcode, uint32 ip, uint16 port)
{
switch(opcode)
{
case OP_REASKCALLBACKUDP:
{
if (thePrefs.GetDebugClientUDPLevel() > 0)
DebugRecv("OP_ReaskCallbackUDP", NULL, NULL, ip);
theStats.AddDownDataOverheadOther(size);
CUpDownClient* buddy = theApp.clientlist->GetBuddy();
if( buddy )
{
if( size < 17 || buddy->socket == NULL )
break;
if (!md4cmp(packet, buddy->GetBuddyID()))
{
PokeUInt32(const_cast<BYTE*>(packet)+10, ip);
PokeUInt16(const_cast<BYTE*>(packet)+14, port);
Packet* response = new Packet(OP_EMULEPROT);
response->opcode = OP_REASKCALLBACKTCP;
response->pBuffer = new char[size];
memcpy(response->pBuffer, packet+10, size-10);
response->size = size-10;
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugSend("OP__ReaskCallbackTCP", buddy);
theStats.AddUpDataOverheadFileRequest(response->size);
buddy->socket->SendPacket(response);
}
}
break;
}
case OP_REASKFILEPING:
{
theStats.AddDownDataOverheadFileRequest(size);
CSafeMemFile data_in(packet, size);
uchar reqfilehash[16];
data_in.ReadHash16(reqfilehash);
CKnownFile* reqfile = theApp.sharedfiles->GetFileByID(reqfilehash);
if (!reqfile)
{
if (thePrefs.GetDebugClientUDPLevel() > 0) {
DebugRecv("OP_ReaskFilePing", NULL, reqfilehash, ip);
DebugSend("OP__FileNotFound", NULL);
}
Packet* response = new Packet(OP_FILENOTFOUND,0,OP_EMULEPROT);
theStats.AddUpDataOverheadFileRequest(response->size);
SendPacket(response, ip, port);
break;
}
CUpDownClient* sender = theApp.uploadqueue->GetWaitingClientByIP_UDP(ip, port);
if (sender)
{
if (thePrefs.GetDebugClientUDPLevel() > 0)
DebugRecv("OP_ReaskFilePing", sender, reqfilehash);
//Make sure we are still thinking about the same file
if (md4cmp(reqfilehash, sender->GetUploadFileID()) == 0)
{
sender->AddAskedCount();
sender->SetLastUpRequest();
//I messed up when I first added extended info to UDP
//I should have originally used the entire ProcessExtenedInfo the first time.
//So now I am forced to check UDPVersion to see if we are sending all the extended info.
//For now on, we should not have to change anything here if we change
//anything to the extended info data as this will be taken care of in ProcessExtendedInfo()
//Update extended info.
if (sender->GetUDPVersion() > 3)
{
sender->ProcessExtendedInfo(&data_in, reqfile);
}
//Update our complete source counts.
else if (sender->GetUDPVersion() > 2)
{
uint16 nCompleteCountLast= sender->GetUpCompleteSourcesCount();
uint16 nCompleteCountNew = data_in.ReadUInt16();
sender->SetUpCompleteSourcesCount(nCompleteCountNew);
if (nCompleteCountLast != nCompleteCountNew)
{
reqfile->UpdatePartsInfo();
}
}
CSafeMemFile data_out(128);
if(sender->GetUDPVersion() > 3)
{
if (reqfile->IsPartFile())
((CPartFile*)reqfile)->WritePartStatus(&data_out);
else
data_out.WriteUInt16(0);
}
data_out.WriteUInt16(theApp.uploadqueue->GetWaitingPosition(sender));
if (thePrefs.GetDebugClientUDPLevel() > 0)
DebugSend("OP__ReaskAck", sender);
Packet* response = new Packet(&data_out, OP_EMULEPROT);
response->opcode = OP_REASKACK;
theStats.AddUpDataOverheadFileRequest(response->size);
theApp.clientudp->SendPacket(response, ip, port);
}
else
{
//.........这里部分代码省略.........