Official eMule-Board: Correctly Initialize Buddy Ping Pong Time - Official eMule-Board

Jump to content


Page 1 of 1

Correctly Initialize Buddy Ping Pong Time it may resolve a mystic buddy disconnect bug

#1 User is offline   Enig123 

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

Posted 09 March 2025 - 06:14 AM

The member of CUpDownClient 'm_dwLastBuddyPingPongTime' was not initialized anywhere, it may cause the connected buddy not able to send ping as it should, thus make buddy disconnected for no reason sometimes.

It can be easily resolved by adding the missing initialization in ClientList.cpp before line 562 with 0.70b code base as follow:
			if (m_nBuddyStatus != Connected) {

				m_pBuddy = cur_client;
				m_nBuddyStatus = Connected;
				m_pBuddy->SetLastBuddyPingPongTime();	//Enig123::bug fix - Mar. 08, 2025
				theApp.emuledlg->serverwnd->UpdateMyInfo();
			}

This post has been edited by Enig123: 09 March 2025 - 06:15 AM

1

#2 User is offline   fox88 

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

Posted 09 March 2025 - 08:49 AM

The value is expected to be initialized at line 570, would it not?
0

#3 User is offline   Enig123 

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

Posted 09 March 2025 - 06:48 PM

View Postfox88, on 09 March 2025 - 12:49 AM, said:

The value is expected to be initialized at line 570, would it not?


Yet uninitialized m_dwLastBuddyPingPongTime has already been used in line 564 invoking SendBuddyPingPong().

Edit: I am not sure there's other logical issue here with the ping pong, need further digging.

Edit2: Okay, these are making more sense to me, in updownclient.h:
	bool			SendBuddyPingPong()								{ return ::GetTickCount() - m_dwLastBuddyPingPongTime > 10*60*1000; }
	bool			AllowIncomeingBuddyPingPong()					{ return ::GetTickCount() - m_dwLastBuddyPingPongTime > 3*60*1000; }
	void			SetLastBuddyPingPongTime()						{ m_dwLastBuddyPingPongTime = ::GetTickCount(); }


This post has been edited by Enig123: 09 March 2025 - 07:08 PM

1

#4 User is offline   fox88 

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

Posted 12 March 2025 - 12:42 PM

View Postfox88, on 09 March 2025 - 11:49 AM, said:

The value is expected to be initialized at line 570

Correction. The value had been initialized on creation.
0

  • Member Options

Page 1 of 1

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