Official eMule-Board: Another Bug In 0.70b Community - Official eMule-Board

Jump to content


Page 1 of 1

Another Bug In 0.70b Community also in ListenSocket.cpp

#1 User is offline   Enig123 

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

Posted 28 August 2024 - 01:02 AM

In ListenSocket.cpp line 585-588:
					if (!creqfile->IsStopped() && creqfile->GetStatus() == PS_PAUSED || creqfile->GetStatus() == PS_ERROR)
						newDS = DS_ONQUEUE;
					else
						newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE

should be
					if (!creqfile->IsStopped()) {
						if  (creqfile->GetStatus() == PS_PAUSED || creqfile->GetStatus() == PS_ERROR)
							newDS = DS_ONQUEUE;
						else
							newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE
					}

to behave in exact way as previous 0.50b version.

Edit: There's another spot in the same file with the same code refactoring that needs to be addressed similarly.

This post has been edited by Enig123: 28 August 2024 - 01:16 AM

0

#2 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5002
  • Joined: 13-May 07

Posted 28 August 2024 - 07:52 AM

I am quite sure that a while ago you suggested to change DS_DONE to DS_ONQUEUE in some places.
Do you think now that here this might cause incorrect behaviour?

This post has been edited by fox88: 28 August 2024 - 07:52 AM

0

#3 User is offline   Enig123 

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

Posted 28 August 2024 - 04:13 PM

View Postfox88, on 28 August 2024 - 12:52 AM, said:

I am quite sure that a while ago you suggested to change DS_DONE to DS_ONQUEUE in some places.
Do you think now that here this might cause incorrect behaviour?


Not related I think. The DS_CONNECTED status is only used as an indicator and never be actually applied here.
0

#4 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5002
  • Joined: 13-May 07

Posted 28 August 2024 - 05:43 PM

There was no question about DS_CONNECTING. What combination of conditions leads to incorrect state change?
0

#5 User is offline   Enig123 

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

Posted 28 August 2024 - 09:48 PM

View Postfox88, on 28 August 2024 - 10:43 AM, said:

There was no question about DS_CONNECTING. What combination of conditions leads to incorrect state change?


If creqfile->IsStopped() is true, your codes would not send cancel transfer signal which it should.
0

#6 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5002
  • Joined: 13-May 07

Posted 29 August 2024 - 09:16 AM

Agreed.
Thanks for the report.
0

#7 User is offline   BuyukBang 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 77
  • Joined: 04-May 23

Posted 29 August 2024 - 10:48 AM

	case OP_SENDINGPART:
		{
			// see also OP_SENDINGPART_I64
			if (thePrefs.GetDebugClientTCPLevel() > 1)
				DebugRecv("OP_SendingPart", client, (size >= 16) ? packet : NULL);
			theStats.AddDownDataOverheadFileRequest(16 + 2 * 4);
			client->CheckHandshakeFinished();
			EDownloadState newDS = DS_NONE;
			const CPartFile *creqfile = client->GetRequestFile();
			if (creqfile) {
				if (!creqfile->IsStopped() && (creqfile->GetStatus() == PS_READY || creqfile->GetStatus() == PS_EMPTY)) {
					client->ProcessBlockPacket(packet, size, false, false);
					if (!creqfile->IsStopped() && creqfile->GetStatus() == PS_PAUSED || creqfile->GetStatus() == PS_ERROR)
						newDS = DS_ONQUEUE;
					else
						newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE
				}
			}
			if (newDS != DS_CONNECTED && client) { //client could have been deleted while debugging
				client->SendCancelTransfer();
				client->SetDownloadState(newDS);
			}
		}
		break;


bool CUpDownClient::CheckHandshakeFinished() const
{
	if (m_bHelloAnswerPending) {
		// 24-Nov-2004 [bc]: The reason for this is that 2 clients are connecting to each other at the same time.
		//if (thePrefs.GetVerbose())
		//	AddDebugLogLine(DLP_VERYLOW, false, _T("Handshake not finished - while processing packet: %s; %s"), DbgGetClientTCPOpcode(protocol, opcode), (LPCTSTR)DbgGetClientInfo());
		return false;
	}

	return true;
}


CheckHandshakeFinished has nothing to do here. There are a lot of similar usage in ListenSocket.

This post has been edited by BuyukBang: 29 August 2024 - 10:49 AM

I’m working on a new project based on eMule v0.70b Community Release, planning to release it by the end of 2024. # SCREENSHOTS # List of completed features:
IPv6 Support & UTP NAT Traversal: Enables IPv6 and LowID to LowID transfers between mod users. (Improved version of David Xanatos’s reference implementation)
Client History: Stores and reloads all clients. Enables long-term banning/punishment intervals, tracking suspicious activities, editable client notes, shared files statistics.
Protection Panel: Detects 28 types of bad clients, bans/punishes with 12 levels. Uses customizable text-based definitions within Shield.conf instead of binary DLP.dll.
Blacklist Panel: Keyword-based file blacklisting for search results. Very fast (Processes 850+ definitions on search results under 1 sec).
Download Checker: Skips known/downloaded/canceled downloads automatically by checking file name similarities and file hashes.
Files List: Lists and categorizes all known files and duplicate files. Fast loading (Loads 200k items under 1 sec).
GeoLite2: Replaced legacy IP2Country, supports IPv6, lists both cities and countries.
Several Connection Tweaks: A fast and reliable connection checker; retry failed TCP connection attempts; reask sources & inform queued clients after IP change.
Empty Fake File & DRM Detection: Automatically removes trash files from the download list.
Fast Kad: Provides much faster KAD searches comparable to eServer search speed.
Auto Query Shared Files: A new way of finding files!
Highly Responsive GUI, Automatic File Extension Correction, Automatic & Manual Saving All App Data, Added Column Filters To All Lists, Intelligent Chunk Selection, Client Emulation, Selectable Credit Systems, Save & Load File Sources, And many more additional features, bug fixes and optimizations…
To do: IPv6 support for KAD, NAT-T support for eServer, Dark Mode, more...
0

#8 User is offline   BuyukBang 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 77
  • Joined: 04-May 23

Posted 29 August 2024 - 11:12 AM

View PostEnig123, on 28 August 2024 - 04:02 AM, said:

In ListenSocket.cpp line 585-588:
					if (!creqfile->IsStopped() && creqfile->GetStatus() == PS_PAUSED || creqfile->GetStatus() == PS_ERROR)
						newDS = DS_ONQUEUE;
					else
						newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE

should be
					if (!creqfile->IsStopped()) {
						if  (creqfile->GetStatus() == PS_PAUSED || creqfile->GetStatus() == PS_ERROR)
							newDS = DS_ONQUEUE;
						else
							newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE
					}

to behave in exact way as previous 0.50b version.

Edit: There's another spot in the same file with the same code refactoring that needs to be addressed similarly.


"!creqfile->IsStopped()" check is already included in upper if block, so "!creqfile->IsStopped()" is always true inside that part. Then your suggestion and the current 0.70b are logically equal.

			if (creqfile) {
				if (!creqfile->IsStopped() && (creqfile->GetStatus() == PS_READY || creqfile->GetStatus() == PS_EMPTY)) {
					client->ProcessBlockPacket(packet, size, false, false);
					if (!creqfile->IsStopped() && creqfile->GetStatus() == PS_PAUSED || creqfile->GetStatus() == PS_ERROR)
						newDS = DS_ONQUEUE;
					else
						newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE
				}
			}


This post has been edited by BuyukBang: 29 August 2024 - 11:20 AM

I’m working on a new project based on eMule v0.70b Community Release, planning to release it by the end of 2024. # SCREENSHOTS # List of completed features:
IPv6 Support & UTP NAT Traversal: Enables IPv6 and LowID to LowID transfers between mod users. (Improved version of David Xanatos’s reference implementation)
Client History: Stores and reloads all clients. Enables long-term banning/punishment intervals, tracking suspicious activities, editable client notes, shared files statistics.
Protection Panel: Detects 28 types of bad clients, bans/punishes with 12 levels. Uses customizable text-based definitions within Shield.conf instead of binary DLP.dll.
Blacklist Panel: Keyword-based file blacklisting for search results. Very fast (Processes 850+ definitions on search results under 1 sec).
Download Checker: Skips known/downloaded/canceled downloads automatically by checking file name similarities and file hashes.
Files List: Lists and categorizes all known files and duplicate files. Fast loading (Loads 200k items under 1 sec).
GeoLite2: Replaced legacy IP2Country, supports IPv6, lists both cities and countries.
Several Connection Tweaks: A fast and reliable connection checker; retry failed TCP connection attempts; reask sources & inform queued clients after IP change.
Empty Fake File & DRM Detection: Automatically removes trash files from the download list.
Fast Kad: Provides much faster KAD searches comparable to eServer search speed.
Auto Query Shared Files: A new way of finding files!
Highly Responsive GUI, Automatic File Extension Correction, Automatic & Manual Saving All App Data, Added Column Filters To All Lists, Intelligent Chunk Selection, Client Emulation, Selectable Credit Systems, Save & Load File Sources, And many more additional features, bug fixes and optimizations…
To do: IPv6 support for KAD, NAT-T support for eServer, Dark Mode, more...
0

#9 User is offline   Enig123 

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

Posted 29 August 2024 - 07:49 PM

View PostBuyukBang, on 29 August 2024 - 04:12 AM, said:

"!creqfile->IsStopped()" check is already included in upper if block, so "!creqfile->IsStopped()" is always true inside that part. Then your suggestion and the current 0.70b are logically equal.

Not 100% sure if it will stand later, technically it could has been altered.

Edit: An example is "Pause when preview possible" enabled.

This post has been edited by Enig123: 29 August 2024 - 07:50 PM

0

#10 User is offline   BuyukBang 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 77
  • Joined: 04-May 23

Posted 30 August 2024 - 07:37 AM

View PostEnig123, on 29 August 2024 - 10:49 PM, said:

View PostBuyukBang, on 29 August 2024 - 04:12 AM, said:

"!creqfile->IsStopped()" check is already included in upper if block, so "!creqfile->IsStopped()" is always true inside that part. Then your suggestion and the current 0.70b are logically equal.

Not 100% sure if it will stand later, technically it could has been altered.

Edit: An example is "Pause when preview possible" enabled.


No, it's not possible in this case. This is all happening in the main thread, and we're talking about consequent lines.
I’m working on a new project based on eMule v0.70b Community Release, planning to release it by the end of 2024. # SCREENSHOTS # List of completed features:
IPv6 Support & UTP NAT Traversal: Enables IPv6 and LowID to LowID transfers between mod users. (Improved version of David Xanatos’s reference implementation)
Client History: Stores and reloads all clients. Enables long-term banning/punishment intervals, tracking suspicious activities, editable client notes, shared files statistics.
Protection Panel: Detects 28 types of bad clients, bans/punishes with 12 levels. Uses customizable text-based definitions within Shield.conf instead of binary DLP.dll.
Blacklist Panel: Keyword-based file blacklisting for search results. Very fast (Processes 850+ definitions on search results under 1 sec).
Download Checker: Skips known/downloaded/canceled downloads automatically by checking file name similarities and file hashes.
Files List: Lists and categorizes all known files and duplicate files. Fast loading (Loads 200k items under 1 sec).
GeoLite2: Replaced legacy IP2Country, supports IPv6, lists both cities and countries.
Several Connection Tweaks: A fast and reliable connection checker; retry failed TCP connection attempts; reask sources & inform queued clients after IP change.
Empty Fake File & DRM Detection: Automatically removes trash files from the download list.
Fast Kad: Provides much faster KAD searches comparable to eServer search speed.
Auto Query Shared Files: A new way of finding files!
Highly Responsive GUI, Automatic File Extension Correction, Automatic & Manual Saving All App Data, Added Column Filters To All Lists, Intelligent Chunk Selection, Client Emulation, Selectable Credit Systems, Save & Load File Sources, And many more additional features, bug fixes and optimizations…
To do: IPv6 support for KAD, NAT-T support for eServer, Dark Mode, more...
0

#11 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5002
  • Joined: 13-May 07

Posted 30 August 2024 - 09:36 AM

View PostEnig123, on 29 August 2024 - 12:48 AM, said:

If creqfile->IsStopped() is true, your codes would not send cancel transfer signal which it should.

After a bit of thinking, the code may be:
client->ProcessBlockPacket(packet, size, false, false);
if (!creqfile->IsStopped() && creqfile->GetStatus() == PS_ERROR)
	newDS = DS_ONQUEUE;
else
	newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE

Other cases should have been handled already.
0

#12 User is offline   Enig123 

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

Posted 30 August 2024 - 07:28 PM

View Postfox88, on 30 August 2024 - 02:36 AM, said:

After a bit of thinking, the code may be:
client->ProcessBlockPacket(packet, size, false, false);
if (!creqfile->IsStopped() && creqfile->GetStatus() == PS_ERROR)
	newDS = DS_ONQUEUE;
else
	newDS = DS_CONNECTED; //any state but DS_NONE or DS_ONQUEUE

Other cases should have been handled already.


To keep the codes as simple and straightforward as possible, that would be my preference.

Implying or omitting will have more chance that would lead to potential bugs.
0

#13 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5002
  • Joined: 13-May 07

Posted 31 August 2024 - 11:52 AM

Code correctness is mandatory; aesthetics - optional and subjective.
0

  • Member Options

Page 1 of 1

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