while checking the code for possibilities to implement some SUC enhancements I noticed the following:
Quote
case OP_REQUESTFILENAME:
{
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugRecv("OP_FileRequest", client, (size >= 16) ? packet : NULL);
theStats.AddDownDataOverheadFileRequest(size);
if (size >= 16)
{
if (!client->GetWaitStartTime())
client->SetWaitStartTime();
CSafeMemFile data_in(packet, size);
uchar reqfilehash[16];
data_in.ReadHash16(reqfilehash);
CKnownFile* reqfile;
if ( (reqfile = theApp.sharedfiles->GetFileByID(reqfilehash)) == NULL )
{
if ( !((reqfile = theApp.downloadqueue->GetFileByID(reqfilehash)) != NULL
&& reqfile->GetFileSize() > (uint64)PARTSIZE) )
{
client->CheckFailedFileIdReqs(reqfilehash);
break;
}
}
if (reqfile->IsLargeFile() && !client->SupportsLargeFiles())
{
DebugLogWarning(_T("Client without 64bit file support requested large file; %s, File=\"%s\""), client->DbgGetClientInfo(), reqfile->GetFileName());
break;
}
// check to see if this is a new file they are asking for
if (md4cmp(client->GetUploadFileID(), reqfilehash) != 0)
client->SetCommentDirty();
client->SetUploadFileID(reqfile);
...
...
{
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugRecv("OP_FileRequest", client, (size >= 16) ? packet : NULL);
theStats.AddDownDataOverheadFileRequest(size);
if (size >= 16)
{
if (!client->GetWaitStartTime())
client->SetWaitStartTime();
CSafeMemFile data_in(packet, size);
uchar reqfilehash[16];
data_in.ReadHash16(reqfilehash);
CKnownFile* reqfile;
if ( (reqfile = theApp.sharedfiles->GetFileByID(reqfilehash)) == NULL )
{
if ( !((reqfile = theApp.downloadqueue->GetFileByID(reqfilehash)) != NULL
&& reqfile->GetFileSize() > (uint64)PARTSIZE) )
{
client->CheckFailedFileIdReqs(reqfilehash);
break;
}
}
if (reqfile->IsLargeFile() && !client->SupportsLargeFiles())
{
DebugLogWarning(_T("Client without 64bit file support requested large file; %s, File=\"%s\""), client->DbgGetClientInfo(), reqfile->GetFileName());
break;
}
// check to see if this is a new file they are asking for
if (md4cmp(client->GetUploadFileID(), reqfilehash) != 0)
client->SetCommentDirty();
client->SetUploadFileID(reqfile);
...
...
In both cases the NOFIL answer (like in the multipacket handler) seems to be missing? I added it now (though that shouldn't affect most clients):
Quote
case OP_REQUESTFILENAME:
{
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugRecv("OP_FileRequest", client, (size >= 16) ? packet : NULL);
theStats.AddDownDataOverheadFileRequest(size);
if (size >= 16)
{
if (!client->GetWaitStartTime())
client->SetWaitStartTime();
CSafeMemFile data_in(packet, size);
uchar reqfilehash[16];
data_in.ReadHash16(reqfilehash);
CKnownFile* reqfile;
if ( (reqfile = theApp.sharedfiles->GetFileByID(reqfilehash)) == NULL )
{
if ( !((reqfile = theApp.downloadqueue->GetFileByID(reqfilehash)) != NULL
&& reqfile->GetFileSize() > (uint64)PARTSIZE) )
{
//>>> WiZaRd::Missing code?
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugSend("OP__FileReqAnsNoFil", client, packet);
Packet* replypacket = new Packet(OP_FILEREQANSNOFIL, 16);
md4cpy(replypacket->pBuffer, reqfilehash);
theStats.AddUpDataOverheadFileRequest(replypacket->size);
SendPacket(replypacket, true);
//<<< WiZaRd::Missing code?
client->CheckFailedFileIdReqs(reqfilehash);
break;
}
}
if (reqfile->IsLargeFile() && !client->SupportsLargeFiles())
{
//>>> WiZaRd::Missing code?
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugSend("OP__FileReqAnsNoFil", client, packet);
Packet* replypacket = new Packet(OP_FILEREQANSNOFIL, 16);
md4cpy(replypacket->pBuffer, reqfile->GetFileHash());
theStats.AddUpDataOverheadFileRequest(replypacket->size);
SendPacket(replypacket, true);
//<<< WiZaRd::Missing code?
DebugLogWarning(_T("Client without 64bit file support requested large file; %s, File=\"%s\""), client->DbgGetClientInfo(), reqfile->GetFileName());
break;
}
// check to see if this is a new file they are asking for
if (md4cmp(client->GetUploadFileID(), reqfilehash) != 0)
client->SetCommentDirty();
client->SetUploadFileID(reqfile);
{
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugRecv("OP_FileRequest", client, (size >= 16) ? packet : NULL);
theStats.AddDownDataOverheadFileRequest(size);
if (size >= 16)
{
if (!client->GetWaitStartTime())
client->SetWaitStartTime();
CSafeMemFile data_in(packet, size);
uchar reqfilehash[16];
data_in.ReadHash16(reqfilehash);
CKnownFile* reqfile;
if ( (reqfile = theApp.sharedfiles->GetFileByID(reqfilehash)) == NULL )
{
if ( !((reqfile = theApp.downloadqueue->GetFileByID(reqfilehash)) != NULL
&& reqfile->GetFileSize() > (uint64)PARTSIZE) )
{
//>>> WiZaRd::Missing code?
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugSend("OP__FileReqAnsNoFil", client, packet);
Packet* replypacket = new Packet(OP_FILEREQANSNOFIL, 16);
md4cpy(replypacket->pBuffer, reqfilehash);
theStats.AddUpDataOverheadFileRequest(replypacket->size);
SendPacket(replypacket, true);
//<<< WiZaRd::Missing code?
client->CheckFailedFileIdReqs(reqfilehash);
break;
}
}
if (reqfile->IsLargeFile() && !client->SupportsLargeFiles())
{
//>>> WiZaRd::Missing code?
if (thePrefs.GetDebugClientTCPLevel() > 0)
DebugSend("OP__FileReqAnsNoFil", client, packet);
Packet* replypacket = new Packet(OP_FILEREQANSNOFIL, 16);
md4cpy(replypacket->pBuffer, reqfile->GetFileHash());
theStats.AddUpDataOverheadFileRequest(replypacket->size);
SendPacket(replypacket, true);
//<<< WiZaRd::Missing code?
DebugLogWarning(_T("Client without 64bit file support requested large file; %s, File=\"%s\""), client->DbgGetClientInfo(), reqfile->GetFileName());
break;
}
// check to see if this is a new file they are asking for
if (md4cmp(client->GetUploadFileID(), reqfilehash) != 0)
client->SetCommentDirty();
client->SetUploadFileID(reqfile);
GreetZ,
WiZ
PS: stupid CODE-tag doesn't support colors and stupid QUOTE-tag destroys the tabbing... great...
This post has been edited by tHeWiZaRdOfDoS: 27 February 2007 - 07:27 PM