aiocurl icon indicating copy to clipboard operation
aiocurl copied to clipboard

CurlMulti not destroyed

Open dwap opened this issue 3 years ago • 0 comments

I quickly sketched out how to get rid of circular references

class CurlMulti:
    def __init__(self):
        self._multi = CurlMultiSync()

        self._scb = self._socket_callback
        self._tcb = self._timer_callback

        # Set a callback for registering or unregistering socket events.
        self._multi.setopt(M_SOCKETFUNCTION, self._scb)

        # Set a callback for scheduling or cancelling timeout actions.
        self._multi.setopt(M_TIMERFUNCTION, self._tcb)
...
 def close(self):
        "Stop any running transfers and close this multi handle."
        for handle in tuple(self._transfers):
            self.stop(handle)
        self._multi.close()
        del self._multi
        del self._scb
        del self._tcb

Check, please

dwap avatar Oct 26 '22 07:10 dwap