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

Recover original "swarm connect" behaviour with a flag #6313

Open
hsanjuan opened this issue May 9, 2019 · 3 comments
Open

Recover original "swarm connect" behaviour with a flag #6313

hsanjuan opened this issue May 9, 2019 · 3 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@hsanjuan
Copy link
Contributor

hsanjuan commented May 9, 2019

Version information: master

Type: Enhancement

Description:

From 0.4.20 swarm connect tags connections with a harcoded weight of 100:

https://github.com/ipfs/go-ipfs/blob/master/core/coreapi/swarm.go#L31

This should indicate the ConnManager that those connections should be kept alive (although it may not work #6271 ). That happens around here:

https://github.com/libp2p/go-libp2p-connmgr/blob/master/connmgr.go#L157

where peers are sorted based on the value resulting from the sum of their tags.

There should be a way (an extra flag for example) to just swarm connect normally to a peer like it happened before. The idea is tha swarm connect can be used to bootstrap the swarm but does not necessarily mean that the connected peer should have priority over any others when it comes to disposing of connections. Or at least the weight should be selectable by the user.

I was going to do this but it seems to require changes to coreapi (to pass tags/weights), so better discuss before.

@Stebalien Stebalien added the kind/bug A bug in existing code (including security flaws) label May 9, 2019
@Stebalien
Copy link
Member

I'd also be happy to make setting a weight a flag.

@hsanjuan
Copy link
Contributor Author

hsanjuan commented May 9, 2019

We can either extend the Connect core api method to take a weight, or we could start carrying connmgr tags in PeerInfos objects (which doesn't sound completely out of place at least, given that connmgr tags are peer information in end)...

@Stebalien
Copy link
Member

We can also just tag outside the CoreAPI manually (until we come up with a nice API for this). Alternatively, allowing options is probably sane. We can then just make this:

ipfs swarm connect --tag myservice=50 --tag other=2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

2 participants