+ Better management of deconnection issue

This commit is contained in:
garnier-quentin 2016-05-26 15:53:09 +02:00
parent 81f9a6e995
commit bc01c36c46
1 changed files with 6 additions and 3 deletions

View File

@ -264,13 +264,15 @@ sub run {
### ###
# Manage vpshere connection # Manage vpshere connection
### ###
if (defined($connector->{last_time_vsphere}) && defined($connector->{last_time_check}) if ($connector->{vsphere_connected} == 1 &&
&& $connector->{last_time_vsphere} < $connector->{last_time_check}) { defined($connector->{last_time_vsphere}) && defined($connector->{last_time_check}) &&
$connector->{last_time_vsphere} < $connector->{last_time_check}) {
$connector->{logger}->writeLogError("'" . $connector->{whoaim} . "' Disconnect"); $connector->{logger}->writeLogError("'" . $connector->{whoaim} . "' Disconnect");
$connector->{vsphere_connected} = 0; $connector->{vsphere_connected} = 0;
eval { eval {
$connector->{session1}->logout(); $connector->{session1}->logout();
}; };
delete $connector->{session1};
} }
if ($connector->{vsphere_connected} == 0) { if ($connector->{vsphere_connected} == 0) {
@ -295,7 +297,8 @@ sub run {
### ###
# Manage session time # Manage session time
### ###
if (defined($connector->{keeper_session_time}) && if ($connector->{vsphere_connected} == 1 &&
defined($connector->{keeper_session_time}) &&
(time() - $connector->{keeper_session_time}) > ($connector->{config_vsphere_session_heartbeat} * 60)) { (time() - $connector->{keeper_session_time}) > ($connector->{config_vsphere_session_heartbeat} * 60)) {
centreon::vmware::common::heartbeat(connector => $connector); centreon::vmware::common::heartbeat(connector => $connector);
} }