1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

get the version from rtorrent out of the loop and cache it already to avoid SOCK to be overwritten

This commit is contained in:
Younes Ichiche 2020-04-05 12:48:28 +02:00 committed by Lars Kruse
parent 54ad1ad4d5
commit 9534979768
2 changed files with 10 additions and 3 deletions

View file

@ -104,9 +104,12 @@ sub rtorrent_version_lower_than {
}
close (SOCK);
}
return version->parse($rtorrent_version) < version->parse($_[0]);
if(defined $_[0]){
return version->parse($rtorrent_version) < version->parse($_[0]);
}
}
# init rtorrent_version
rtorrent_version_lower_than();
my $pattern = qr/<value><string>([A-Z0-9]+)<\/string><\/value>/;

View file

@ -106,8 +106,12 @@ sub rtorrent_version_lower_than {
}
close (SOCK);
}
return version->parse($rtorrent_version) < version->parse($_[0]);
if(defined $_[0]){
return version->parse($rtorrent_version) < version->parse($_[0]);
}
}
# init rtorrent_version
rtorrent_version_lower_than();
my $pattern = qr/<value><string>([A-Z0-9]+)<\/string><\/value>/;