aioice icon indicating copy to clipboard operation
aioice copied to clipboard

Multiple early checks from same source results in unhandled tasks

Open ddiaz-yx opened this issue 1 year ago • 1 comments

Tested on version 0.7.6.

If multiple checks from a remote peer arrive before _check_list from Connection class is set, then all of them are appended to the _early_checks list and then acted upon on the connect method:

        # handle early checks
        for early_check in self._early_checks:
            self.check_incoming(*early_check)
        self._early_checks = []

Then the check_incoming method creates a task for each early check and overwrites the handle for the associated pair:

            pair.handle = asyncio.ensure_future(self.check_start(pair))

Since the handle for some tasks is lost, they become unreachable and are not canceled after completion.

It is even possible to see mutiple times a transition State.IN_PROGRESS -> State.IN_PROGRESS for some candidate pairs.

ddiaz-yx avatar Aug 19 '22 12:08 ddiaz-yx

Sounds like a valid point, would you be ready to contribute a PR?

jlaine avatar Oct 16 '22 10:10 jlaine