vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
249 stars 54 forks source link

Handle graceful shutdown on TransportUseClosedError. #1065

Open AlejandroCabeza opened 6 months ago

AlejandroCabeza commented 6 months ago

fixes: https://github.com/status-im/nim-libp2p/issues/1007

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 82.53%. Comparing base (ca01ee0) to head (3e56745). Report is 2 commits behind head on unstable.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1065/graphs/tree.svg?width=650&height=150&src=pr&token=UR5JRQ249W&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1065?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) ```diff @@ Coverage Diff @@ ## unstable #1065 +/- ## ============================================ - Coverage 82.81% 82.53% -0.28% ============================================ Files 91 91 Lines 15750 15822 +72 ============================================ + Hits 13043 13059 +16 - Misses 2707 2763 +56 ``` | [Files](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1065?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) | Coverage Δ | | |---|---|---| | [libp2p/switch.nim](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1065?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im#diff-bGlicDJwL3N3aXRjaC5uaW0=) | `88.61% <22.22%> (-3.14%)` | :arrow_down: | ... and [7 files with indirect coverage changes](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1065/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)
AlejandroCabeza commented 6 months ago

LGTM, just a minor request. It'd be great if we could add a test too.

That's a good idea, but it might be a tad too hard for me: Can you point me to an already existing test I can use as template where accept is being tested/called? Also, I don't know how to raise the TransportUseClosedError which is necessary for the test, or how to mock it, for that matter.

Otherwise, this might be too time-consuming (for me).

diegomrsantos commented 6 months ago

If testing it is too time consuming, or not even possible, that's fine.

kaiserd commented 5 months ago

What is the status here?

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Project coverage is 84.53%. Comparing base (02c96fc) to head (453bcc6). Report is 30 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/vacp2p/nim-libp2p/pull/1065/graphs/tree.svg?width=650&height=150&src=pr&token=M88zHaQffJ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacp2p)](https://app.codecov.io/gh/vacp2p/nim-libp2p/pull/1065?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacp2p) ```diff @@ Coverage Diff @@ ## master #1065 +/- ## ========================================== - Coverage 84.53% 84.53% -0.01% ========================================== Files 91 92 +1 Lines 15517 16414 +897 ========================================== + Hits 13118 13875 +757 - Misses 2399 2539 +140 ``` | [Files](https://app.codecov.io/gh/vacp2p/nim-libp2p/pull/1065?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacp2p) | Coverage Δ | | |---|---|---| | [libp2p/switch.nim](https://app.codecov.io/gh/vacp2p/nim-libp2p/pull/1065?src=pr&el=tree&filepath=libp2p%2Fswitch.nim&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacp2p#diff-bGlicDJwL3N3aXRjaC5uaW0=) | `89.28% <22.22%> (-2.43%)` | :arrow_down: | ... and [77 files with indirect coverage changes](https://app.codecov.io/gh/vacp2p/nim-libp2p/pull/1065/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vacp2p)