[nexuiz-commits] r8006 - trunk/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Oct 2 05:28:04 EDT 2009


Author: div0
Date: 2009-10-02 05:28:04 -0400 (Fri, 02 Oct 2009)
New Revision: 8006

Modified:
   trunk/server/rcon.pl
Log:
make getchallenge timeout configurable


Modified: trunk/server/rcon.pl
===================================================================
--- trunk/server/rcon.pl	2009-10-02 08:20:54 UTC (rev 8005)
+++ trunk/server/rcon.pl	2009-10-02 09:28:04 UTC (rev 8006)
@@ -386,12 +386,13 @@
 #   my $chan = new Channel::QW($connection, "password");
 sub new($$$)
 {
-	my ($class, $conn, $password, $secure) = @_;
+	my ($class, $conn, $password, $secure, $timeout) = @_;
 	my $you = {
 		connector => $conn,
 		password => $password,
 		recvbuf => "",
 		secure => $secure,
+		timeout => $timeout,
 	};
 	return
 		bless $you, 'Channel::QW';
@@ -442,7 +443,7 @@
 	my ($self) = @_;
 
 	my $sel = IO::Select->new($self->fds());
-	my $endtime_max = Time::HiRes::time() + 1;
+	my $endtime_max = Time::HiRes::time() + $self->{timeout};
 	my $endtime = $endtime_max;
 
 	while((my $dt = $endtime - Time::HiRes::time()) > 0)
@@ -516,12 +517,13 @@
 	return $default;
 }
 
-my $server   = default '',    $ENV{rcon_address};
-my $password = default '',    $ENV{rcon_password};
-my $secure   = default '1',   $ENV{rcon_secure};
-my $timeout  = default '5',   $ENV{rcon_timeout};
-my $timeouti = default '0.2', $ENV{rcon_timeout_inter};
-my $colors   = default '0',   $ENV{rcon_colorcodes_raw};
+my $server   = default '',       $ENV{rcon_address};
+my $password = default '',       $ENV{rcon_password};
+my $secure   = default '1',      $ENV{rcon_secure};
+my $timeout  = default '5',      $ENV{rcon_timeout};
+my $timeouti = default '0.2',    $ENV{rcon_timeout_inter};
+my $timeoutc = default $timeout, $ENV{rcon_timeout_challenge};
+my $colors   = default '0',      $ENV{rcon_colorcodes_raw};
 
 if(!length $server)
 {
@@ -534,7 +536,7 @@
 }
 
 my $connection = Connection::Socket->new("udp", "", $server, 26000);
-my $rcon = Channel::QW->new($connection, $password, $secure);
+my $rcon = Channel::QW->new($connection, $password, $secure, $timeoutc);
 
 if(!$rcon->send($rcon->join_commands(@ARGV)))
 {



More information about the nexuiz-commits mailing list