Skip to content
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

how to hold a connection for a long time #474

Closed
thomas92911 opened this issue Nov 7, 2018 · 3 comments
Closed

how to hold a connection for a long time #474

thomas92911 opened this issue Nov 7, 2018 · 3 comments

Comments

@thomas92911
Copy link

thomas92911 commented Nov 7, 2018

I have two ipfs nodes, A is in nat, B is public, I need B to do relay service to A.

So, I need to keep a long time connection between A and B.

How to do it

Now my approach is

A:
for {
     Ipfs swarm connect B
}

thomas92911 from (ARS.China)

@thomas92911 thomas92911 changed the title how to hold a connect for a long time how to hold a connection for a long time Nov 7, 2018
@vyzo
Copy link
Contributor

vyzo commented Nov 7, 2018

You can tag the connection if you are using a connection manager.
See Host.ConnManager().TagPeer() for the interface; you should pass the libp2p.ConnManager() option to the constructor.

@raulk
Copy link
Member

raulk commented Nov 7, 2018

^^ for now that's the way. I'm conceptualising a new connection manager interface that, amongst other things, will support time-locking connections, and getting callbacks when the lock expires.

@thomas92911
Copy link
Author

thomas92911 commented Nov 8, 2018

You can tag the connection if you are using a connection manager.
See Host.ConnManager().TagPeer() for the interface; you should pass the libp2p.ConnManager() option to the constructor.

^^ for now that's the way. I'm conceptualising a new connection manager interface that, amongst other things, will support time-locking connections, and getting callbacks when the lock expires.

thx

Improved Connection Manager #475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants