def _keepalive(self):
        """Performs a keepalive to avoid idle disconnect
        """
        try:
            keptalive = False
            if self._customkeepalives:
                kaids = list(self._customkeepalives.keys())
                for keepalive in kaids:
                    try:
                        cmd, callback = self._customkeepalives[keepalive]
                    except TypeError:
                        # raw_command made customkeepalives None
                        break
                    except KeyError:
                        # raw command ultimately caused a keepalive to
                        # deregister
                        continue
                    if callable(cmd):
                        cmd()
                        continue
                    keptalive = True
                    cmd['callback'] = self._keepalive_wrapper(callback)
                    self.raw_command(**cmd)
            if not keptalive:
                if self.incommand:
                    # if currently in command, no cause to keepalive
                    return
                self.raw_command(netfn=6, command=1,
                                 callback=self._keepalive_wrapper(None))
        except exc.IpmiException:
            self._mark_broken()
def _keepalive ( self ) : try : keptalive = False if self . _customkeepalives : kaids = list ( self . _customkeepalives . keys ( ) ) for keepalive in kaids : try : cmd , callback = self . _customkeepalives [ keepalive ] except TypeError : break except KeyError : continue if callable ( cmd ) : cmd ( ) continue keptalive = True cmd [ 'callback' ] = self . _keepalive_wrapper ( callback ) self . raw_command ( ** cmd ) if not keptalive : if self . incommand : return self . raw_command ( netfn = 6 , command = 1 , callback = self . _keepalive_wrapper ( None ) ) except exc . IpmiException : self . _mark_broken ( )
Performs a keepalive to avoid idle disconnect