Esempio n. 1
0
    def connectionLost(self, reason):
        '''Tell the other peers that this one has died.'''
        if reason.check(TIError.ConnectionDone) is None:  # Dirty
            txt = 'Dirty'
        else:
            txt = 'Clean'
        self.SI.logmsg('%s disconnect from peer id %d' % (txt, self.id))
        if self.id in self.SI.clients:  # Only if everything was completed
            del self.SI.clients[self.id]
        if self.SI.args.recycle:
            self.SI.recycled[self.id] = self
            return

        try:
            for other_peer in self.SI.clients.values():
                ivshmem_send_one_msg(other_peer.transport.socket, self.id)

            for EN in self.EN_list:
                EN.cleanup()

            # For QEMU crashes and shutdowns.  Not the VM, but QEMU itself.
            FAMEZ_MailBox.clear_mailslot(self.id)

        except Exception as e:
            self.SI.logmsg('Closing peer transports failed: %s' % str(e))
Esempio n. 2
0
 def connectionLost(self, reason):
     if reason.check(TIError.ConnectionDone) is None:  # Dirty
         print('Dirty disconnect')
     else:
         print('Clean disconnect')
     FAMEZ_MailBox.clear_mailslot(self.id)  # In particular, nodename
     # FIXME: if reactor.isRunning:
     TIreactor.stop()