[FIX] - Freeze for OpenKore when Poisedon Server gets Frozen

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
Fr3DBr
Developers
Developers
Posts: 60
Joined: 05 Oct 2011, 09:21
Noob?: No
Location: Brazil

[FIX] - Freeze for OpenKore when Poisedon Server gets Frozen

#1 Post by Fr3DBr »

Hello,

I am writing and contributing with my first fix for openkore, it will add a timeout for the Game Guard connection state (it doesn't exists on last svn) so the bot gets frozen forever until restart.

Here is how to fix it :

For : DirectConnection.pm do the following changes :

Find :

Code: Select all

# GameGuard support
if ($self->serverAlive && $config{gameGuard} == 2) {
	my $msg = pack("C*", 0x58, 0x02);
	$net->serverSend($msg);
	message T("Requesting permission to logon on account server...\n");
	$conState = 1.2;
	return;
}
And change to :

Code: Select all

# GameGuard support
if ($self->serverAlive && $config{gameGuard} == 2) {
	my $msg = pack("C*", 0x58, 0x02);
	$net->serverSend($msg);
	message T("Requesting permission to logon on account server...\n");
	$conState = 1.2;
	$self->{gstimeout} = time;
	return;
}
Still in DirectConnection.pm find :

Code: Select all

	$timeout{'master'}{'time'} = time;
# we skipped some required connection operations while waiting for the server to allow as to login,
# after we have successfully sent in the reply to the game guard challenge (using the poseidon server)
# this conState will allow us to continue from where we left off.
} elsif ($self->getState() == 1.3) {
And change to :

Code: Select all

} elsif ($self->getState() == 1.2) {
# Checking if we succesful received the Game Guard Confirmation (Should Happen Sooner)
	if ( time - $self->{gstimeout} > 10 )
	{
		message T("The Game Guard Authorization Request\n");
		message T("has timed out, please check your poseidon server !!\n");
		$self->serverDisconnect;
		$self->setState(Network::NOT_CONNECTED);			
	}
# we skipped some required connection operations while waiting for the server to allow as to login,
# after we have successfully sent in the reply to the game guard challenge (using the poseidon server)
# this conState will allow us to continue from where we left off.
} elsif ($self->getState() == 1.3) {
Then for our last change go to : Client.pm and find this :

Code: Select all

	$self->{privateOnly} = defined($args{privateOnly}) ? $args{privateOnly} : 0;

	# A queue containing messages to be sent next time we're
	# connected to the bus.
And change it to :

Code: Select all

	$self->{privateOnly} = defined($args{privateOnly}) ? $args{privateOnly} : 0;
	$self->{gstimeout} = 0;

	# A queue containing messages to be sent next time we're
	# connected to the bus.
The result of this patch will be now that poseidon server gonna have 10 seconds to reply the bot, if not it will retry the connection again !

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: [FIX] - Freeze for OpenKore when Poisedon Server gets Frozen

#2 Post by kLabMouse »

Fr3DBr
Nice to see you!

Thank's for your Fix. It will be commited Soon.

Locked