fix(relay): external addr not expiring when relayed listen addr expire
Description
We encountered a bug when our app is connected and listening through a relay and that it decided to stop listening through the relay but still let the connection with the relay open (some other streams are opened with this peer), then the previously confirmed ExternalAddress does not expire.
The PR solves this problem and simplify a little bit the way to emit ExternalAddrConfirmed and ExternalAddrExpired by only watching NewListenAddr and ExpiredListenAddr events if they are notifying about a relayed listen address.
Also, when renewing reservation, NewListenAddr should not be emitted again if the same listen_addr is given, but it should emit a ListenAddrExpired event if a previously reserved one was not reserved again.
Notes & open questions
I have also included a correlated change by removing the /p2p/<local_peer_id> of the relayed listen addresses and external addresses (corresponding to a listen addresses). Indeed, every other transport does not include it so I think it is better that the relay transport acts the same. If necessary, I can do a separated PR.
Change checklist
- [x] I have performed a self-review of my own code
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] A changelog entry has been made in the appropriate crates
Thanks! Just as an fyi, there is no need to force push as the commits will all be squashed when it is merged.
This pull request has merge conflicts. Could you please resolve them @stormshield-frb? 🙏