Пример #1
0
    def detach(self, iface: CoreInterface) -> None:
        """
        Detach network interface.

        :param iface: network interface to detach
        :return: nothing
        """
        del self.ifaces[iface.net_id]
        iface.net_id = None
        with self._linked_lock:
            del self._linked[iface]
Пример #2
0
    def attach(self, iface: CoreInterface) -> None:
        """
        Attach network interface.

        :param iface: network interface to attach
        :return: nothing
        """
        i = self.next_iface_id()
        self.ifaces[i] = iface
        iface.net_id = i
        with self._linked_lock:
            self._linked[iface] = {}