Support reconnecting to agents

Agents do not die immediately on disconnect anymore. Instead, agent_id
is sent at birth and can be sent during negotiation to attach to a
disconnected agent.
This commit is contained in:
Petr Baudis 2011-12-08 02:01:56 +01:00
parent 417a5235a0
commit 8ae6051e97
4 changed files with 52 additions and 7 deletions

View file

@ -143,9 +143,14 @@ $socket = IO::Socket::INET->new(
print "[ii] connected\r\n";
# negotiate attributs
print $socket "move 1.0\r\n";
print $socket "attack 1.0\r\n";
print $socket "defense 1.0\r\n";
if ($ARGV[1]) {
print "[ii] recovering agent $ARGV[1]\r\n";
print $socket "agent_id $ARGV[1]\r\n";
} else {
print $socket "move 1.0\r\n";
print $socket "attack 1.0\r\n";
print $socket "defense 1.0\r\n";
}
print $socket "\r\n";
print "[ii] agent created\r\n";