| 335 | |
| 336 | |
| 337 | void CUpDownClient::ProcessFileInfo(const CMemFile* data, const CPartFile* file) |
| 338 | { |
| 339 | // 0.42e |
| 340 | if (file==NULL) { |
| 341 | throw wxString("ERROR: Wrong file ID (ProcessFileInfo; file==NULL)"); |
| 342 | } |
| 343 | if (m_reqfile==NULL) { |
| 344 | throw wxString("ERROR: Wrong file ID (ProcessFileInfo; m_reqfile==NULL)"); |
| 345 | } |
| 346 | if (file != m_reqfile) { |
| 347 | throw wxString("ERROR: Wrong file ID (ProcessFileInfo; m_reqfile!=file)"); |
| 348 | } |
| 349 | |
| 350 | m_clientFilename = data->ReadString((GetUnicodeSupport() != utf8strNone)); |
| 351 | |
| 352 | // 26-Jul-2003: removed requesting the file status for files <= PARTSIZE for better compatibility with ed2k protocol (eDonkeyHybrid). |
| 353 | // if the remote client answers the OP_REQUESTFILENAME with OP_REQFILENAMEANSWER the file is shared by the remote client. if we |
| 354 | // know that the file is shared, we know also that the file is complete and don't need to request the file status. |
| 355 | if (m_reqfile->GetPartCount() == 1) { |
| 356 | m_nPartCount = m_reqfile->GetPartCount(); |
| 357 | |
| 358 | m_reqfile->UpdatePartsFrequency( this, false ); // Decrement |
| 359 | m_downPartStatus.setsize( m_nPartCount, 1 ); |
| 360 | m_reqfile->UpdatePartsFrequency( this, true ); // Increment |
| 361 | |
| 362 | m_bCompleteSource = true; |
| 363 | |
| 364 | UpdateDisplayedInfo(); |
| 365 | // even if the file is <= PARTSIZE, we _may_ need the hashset for that file (if the file size == PARTSIZE) |
| 366 | if (m_reqfile->IsHashSetNeeded()) { |
| 367 | if (m_socket) { |
| 368 | CPacket* packet = new CPacket(OP_HASHSETREQUEST,16, OP_EDONKEYPROT); |
| 369 | packet->Copy16ToDataBuffer((const char *)m_reqfile->GetFileHash().GetHash()); |
| 370 | theStats::AddUpOverheadFileRequest(packet->GetPacketSize()); |
| 371 | AddDebugLogLineN(logLocalClient, "Local Client: OP_HASHSETREQUEST to " + GetFullIP()); |
| 372 | SendPacket(packet,true,true); |
| 373 | SetDownloadState(DS_REQHASHSET); |
| 374 | m_fHashsetRequesting = 1; |
| 375 | m_reqfile->SetHashSetNeeded(false); |
| 376 | } else { |
| 377 | wxFAIL; |
| 378 | } |
| 379 | } else { |
| 380 | SendStartupLoadReq(); |
| 381 | } |
| 382 | m_reqfile->UpdatePartsInfo(); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | void CUpDownClient::ProcessFileStatus(bool bUdpPacket, const CMemFile* data, const CPartFile* file) |
| 387 | { |
no test coverage detected