Official eMule-Board: Missing Code In Listensocket.cpp? - Official eMule-Board

Jump to content


Page 1 of 1

Missing Code In Listensocket.cpp? Missing reaction to OP_REQUESTFILENAME

#1 User is offline   tHeWiZaRdOfDoS 

  • Man, what a bunch of jokers...
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5630
  • Joined: 28-December 02

Post icon  Posted 21 February 2007 - 12:38 PM

Hi there...

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);
...
...

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);


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

0

#2 User is offline   Enig123 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 553
  • Joined: 22-November 04

Posted 18 March 2007 - 01:53 AM

I've tried your code for quite some days, and found some RED error messages like this

Quote

2007-3-12 21:08:25: Error: Unknown exception c0000005 in CClientReqSocket::PacketReceived at 0x0045176a; protocol=eDonkey opcode=OP_REQUESTFILENAME size=30; Client=8527060@62.241.53.17 (24.47.159.122) 'fgdlvj [ePlus]' (eMule Plus v1.2,None/None/None)

appeared a lot. Since it happened to almost all kind of clients, I guess it break something.

Better way to send the 'missing' part might be put into the
void CUploadQueue::InsertInUploadingList(CUpDownClient* newclient)
method as Xman already done.

This post has been edited by Enig123: 18 March 2007 - 05:44 AM

0

#3 User is offline   tHeWiZaRdOfDoS 

  • Man, what a bunch of jokers...
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5630
  • Joined: 28-December 02

Posted 18 March 2007 - 10:03 AM

I don't think so - compare carefully with my code above, I think you did something wrong... because I use that for weeks now and it works correctly :flowers:
0

  • Member Options

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users