示例#1
0
    def detach(self, netif: CoreInterface) -> None:
        """
        Detach network interface.

        :param netif: network interface to detach
        :return: nothing
        """
        del self._netif[netif.netifi]
        netif.netifi = None
        with self._linked_lock:
            del self._linked[netif]
示例#2
0
    def attach(self, netif: CoreInterface) -> None:
        """
        Attach network interface.

        :param netif: network interface to attach
        :return: nothing
        """
        i = self.newifindex()
        self._netif[i] = netif
        netif.netifi = i
        with self._linked_lock:
            self._linked[netif] = {}