p2p_fd: locally ensure fd are closed on socket access errors.
The following discussion from !5096 (merged) should be addressed:
-
@julien.t started a discussion: (+2 comments) Maybe we should locally close the fd before returning the connection_closed error. Thought it might make this MR heavier, we should probably adapt everywhere we use this module to this new behaviour ? Feel free to delay that in a follow-up MR.
It would be nice to have the invariant that any non-recoverable error when accessing a p2p fd occurs, we ensure it is closed.
It is likely that all error arising when accessing the fd are non-recoverable, but we should make sure of it.