dhcppython icon indicating copy to clipboard operation
dhcppython copied to clipboard

Sockets are not closed when DHCPClient object is deleted

Open osresearch opened this issue 3 years ago • 0 comments

The various sockets are not closed when the dhcppython.client.DHCPClient is deleted, which leads to future DCHPClient objects not being able to obtain leases since the replies are delivered to the older sockets instead. I added a __del__ method to the class that closes them and now I can create new client objects:

    def __del__(self):
        for sock in self.listening_sockets:
            sock.close()
        for sock in self.writing_sockets:
            sock.close()
        for sock in self.except_sockets:
            sock.close()

osresearch avatar Jan 27 '23 11:01 osresearch