Skip to content

Commit

Permalink
Change logging
Browse files Browse the repository at this point in the history
1) "Ragnarok Online" replaced by "Poseidon RO server"
2) "Query server" replaced by "Poseidon Query server"
3) "PoseidonServer" replaced by "Poseidon Query server"
4) "RagnarokServer" replaced by "Poseinon RO server"
5) Added arrows indicating the direction of the request
  • Loading branch information
ya4ept committed Dec 22, 2024
1 parent cf47f24 commit 5ca4667
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
31 changes: 14 additions & 17 deletions src/Poseidon/QueryServer.pm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
###########################################################
# Poseidon server - OpenKore communication channel
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# Copyright (c) 2005-2006 OpenKore Development Team
Expand Down Expand Up @@ -66,8 +66,8 @@ sub process {
$client->close();
return;
}
print "[PoseidonServer]-> Received query from bot client " . $client->getIndex() . "\n";

print "[Poseinon Qery server] <- Received request from OpenKore (" . $client->getIndex() . ")\n";

my %request = (
packet => $args->{packet},
Expand Down Expand Up @@ -95,25 +95,23 @@ sub process {
sub onClientNew {
my ($self, $client, $index) = @_;
$client->{"$CLASS parser"} = new Bus::MessageParser();
print "[PoseidonServer]-> New Bot Client Connected : " . $client->getIndex() . "\n";
print "[Poseinon Qery server] <- OpenKore (" . $client->getIndex() . ") connected.\n";
}

sub onClientExit {
my ($self, $client, $index) = @_;
print "[PoseidonServer]-> Bot Client Disconnected : " . $client->getIndex() . "\n";
print "[Poseinon Qery server] -> OpenKore (" . $client->getIndex() . ") disconnected.\n";
}

sub onClientData
{
sub onClientData {
my ($self, $client, $msg) = @_;
my ($ID, $args);

my $parser = $client->{"$CLASS parser"};

$parser->add($msg);

while ($args = $parser->readNext(\$ID))
{

while ($args = $parser->readNext(\$ID)) {
$self->process($client, $ID, $args);
}
}
Expand All @@ -126,8 +124,7 @@ sub iterate {
$server = $self->{"$CLASS server"};
$queue = $self->{"$CLASS queue"};

if ($server->getState() eq 'requested')
{
if ($server->getState() eq 'requested') {
# Send the response to the client.
if (@{$queue} > 0 && $queue->[0]{client}) {
my ($data, %args);
Expand All @@ -137,12 +134,12 @@ sub iterate {
$data = serialize("Poseidon Reply", \%args);
$queue->[0]{client}->send($data);
$queue->[0]{client}->close();
print "[PoseidonServer]-> Sent result to client : " . $queue->[0]{client}->getIndex() . "\n";
print "[Poseinon Qery server] -> Response sent to OpenKore (" . $queue->[0]{client}->getIndex() . ")\n";
}
shift @{$queue};

} elsif (@{$queue} > 0 && $server->getState() eq 'ready') {
print "[PoseidonServer]-> Querying Ragnarok Online client [" . getFormattedDateShort(time, 1) . "]...\n";
print "[Poseinon Qery server] -> Querying RO client [" . getFormattedDateShort(time, 1) . "] ...\n";
$server->query($queue->[0]{packet});
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Poseidon/RagnarokServer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ sub new {
if (!$self->{type}->{$config{server_type}}) {
die "Invalid serverType specified. Please check your poseidon config file.\n";
} else {
print "Building RagnarokServer with serverType $config{server_type}...\n";
print "Building Poseidon RO Server with serverType $config{server_type} ...\n";
}

return $self;
Expand All @@ -97,7 +97,7 @@ sub query {
}
}

print "[RagnarokServer]-> Error: no Ragnarok Online client connected.\n";
print "[Poseinon RO server] Error: no Ragnarok Online client connected.\n";
}

##
Expand Down Expand Up @@ -150,15 +150,15 @@ sub onClientNew {

$self->{challengeNum} = 0;

print "[RagnarokServer]-> Ragnarok Online client ($index) connected.\n";
print "[Poseinon RO server] <- RO client ($index) connected.\n";
}

sub onClientExit {
my ($self, $client, $index) = @_;

$self->{challengeNum} = 0;

print "[RagnarokServer]-> Ragnarok Online client ($index) disconnected.\n";
print "[Poseinon RO server] -> RO client ($index) disconnected.\n";
}

## constants
Expand Down Expand Up @@ -286,7 +286,7 @@ sub ParsePacket {
} elsif (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0277') || ($switch eq '027C') || ($switch eq '02B0') || ($switch eq '0825') || ($switch eq '0987') || ($switch eq '0A76') || ($switch eq '0AAC') || ($switch eq '0B04')) { # master_login
# send account_server_info
my $sex = 1;
my $serverName = pack("a20", "Poseidon server"); # server name should be less than or equal to 20 characters
my $serverName = pack("a20", "Poseidon RO server"); # server name should be less than or equal to 20 characters
my $serverUsers = pack("V", @{$self->clients()} - 1);

my $data;
Expand Down
4 changes: 2 additions & 2 deletions src/Poseidon/poseidon.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ sub initialize {
print "Starting servers...\n";

$roServer = new Poseidon::RagnarokServer($config{ragnarokserver_port}, $config{ragnarokserver_ip});
print "Ragnarok Online Server Ready At : " . $roServer->getHost() . ":" . $roServer->getPort() . "\n";
print "Poseidon RO server is ready : " . $roServer->getHost() . ":" . $roServer->getPort() . "\n";

$queryServer = new Poseidon::QueryServer($config{queryserver_port}, $config{queryserver_ip}, $roServer);
print "Query Server Ready At : " . $queryServer->getHost() . ":" . $queryServer->getPort() . "\n";
print "Poseidon Query server is ready: " . $queryServer->getHost() . ":" . $queryServer->getPort() . "\n";

print ">>> Poseidon $version initialized (Debug : ". (($config{debug}) ? "On" : "Off") . ") <<<\n\n";
print "Please read " . POSEIDON_SUPPORT_URL . " for further instructions.\n";
Expand Down

0 comments on commit 5ca4667

Please sign in to comment.