[Slim-Checkins] r8827 - /trunk/server/Slim/Networking/Slimproto.pm
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Sun Aug 6 08:50:02 PDT 2006
Author: adrian
Date: Sun Aug 6 08:50:00 2006
New Revision: 8827
URL: http://svn.slimdevices.com?rev=8827&view=rev
Log:
Bug: N/A
Description: ensure we cater for time travel in check_all_clients
Underlying issue here is that calling slimproto_close will forget a
client, but doesn't seem to cause the client to attempt to reconnect.
Hence we need to be sure we only do it when we are certain it has gone...
Modified:
trunk/server/Slim/Networking/Slimproto.pm
Modified: trunk/server/Slim/Networking/Slimproto.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/Slimproto.pm?rev=8827&r1=8826&r2=8827&view=diff
==============================================================================
--- trunk/server/Slim/Networking/Slimproto.pm (original)
+++ trunk/server/Slim/Networking/Slimproto.pm Sun Aug 6 08:50:00 2006
@@ -174,6 +174,8 @@
sub check_all_clients {
+ my $now = time();
+
for my $client ( values %sock2client ) {
# SoftSqueeze does not report status
@@ -186,9 +188,10 @@
}
# check when we last heard a stat response from the player
- my $last_heard = $check_time - $heartbeat{$client};
-
- if ( $last_heard >= $check_all_clients_time * 2 ) {
+ my $last_heard = $now - $heartbeat{$client};
+
+ # disconnect client if we haven't heard from it in 3 poll intervals and no time travel
+ if ( $last_heard >= $check_all_clients_time * 3 && $now - $check_time <= $check_all_clients_time ) {
$::d_slimproto && msgf("Haven't heard from %s in %d seconds, closing connection\n",
$client->id,
$last_heard,
@@ -203,7 +206,7 @@
}
}
- $check_time = time() + $check_all_clients_time;
+ $check_time = $now + $check_all_clients_time;
Slim::Utils::Timers::setTimer( undef, $check_time, \&check_all_clients );
}
More information about the checkins
mailing list