-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Closable Transport #999
Proposal: Closable Transport #999
Comments
Looks like this is related to #992. WDYT @Stebalien @vyzo @raulk |
This way, transports with shared resources (e.g., reused sockets) can clean them up. fixes libp2p/go-libp2p#999
It seems reasonable, but I'm not sure if we even need an interface change for this. We can probably just add a |
I don't think we need an interface change for this; we can soft check if the transport implements |
@vyzo @Stebalien yes thx, I didn't even though of that, that certainly prettier. |
Closes (partially) libp2p/go-libp2p#999.
This way, transports with shared resources (e.g., reused sockets) can clean them up. fixes libp2p/go-libp2p#999
This way, transports with shared resources (e.g., reused sockets) can clean them up. fixes libp2p/go-libp2p#999
Unexpected close (I was merging this in my repo for some mod replace rules and this somehow closed this). |
Should the libp2p-quic-transport implement this? |
@marten-seemann |
This way, transports with shared resources (e.g., reused sockets) can clean them up. fixes libp2p/go-libp2p#999
This way, transports with shared resources (e.g., reused sockets) can clean them up. fixes libp2p/go-libp2p#999
This way, transports with shared resources (e.g., reused sockets) can clean them up. fixes #999
Use Case
While writing a tor transport I noticed that some transports runs some node beyond the listener (mainly overlay networks).
For example my tor transport runs a tor node and I need to close it at one point. I can't rely on the listeners to close it because it's not because a node stop listening on an address it will not then dial someone.
Additions
I propose to add this in
go-libp2p-core/transport
:Then in
host.Close()
the host would use reflection to terminate the transport when closing (after closing all listeners) :(Also I can't rely on the garbage collector to do this work because I have some CGO code (or a system fork) and the garbage collector doesn't deal with that.)
In the Future
If in the future a method to unhook transport from a libp2p is added the transport will be closable that way.
The text was updated successfully, but these errors were encountered: