Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Add findprovs #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add findprovs #47

wants to merge 1 commit into from

Conversation

Kubuxu
Copy link
Member

@Kubuxu Kubuxu commented Mar 25, 2017

No description provided.

Copy link
Contributor

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of comments, otherwise LGTM

shell.go Outdated
return nil, resp.Error
}

outchan := make(chan pstore.PeerInfo, 4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make 4 a constant (with a comment), or add comment on why 4


go func() {
<-ctx.Done()
resp.Close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fail to see why not defer resp.Close() in the previous go-routine but I assume there is a reason?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, json.NewDecoder(resp.Output) will hang until the resp is closed. So this thing breaks out the NewDecoder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, if NewDecoder hangs, then it's going to hang until someone cancels the context, because resp.Close() is not called until then, and the context won't be cancelled because NewDecoder is hanging ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We self cancel/exit when responses from the endpoint end. If someone wants to exit early he has to cancel context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, not NewDecoder but decoder.Decode.

@ghost
Copy link

ghost commented Nov 18, 2017

I'm a bit afraid of the added dependencies -- let's revisit this when we have the first parts of the Core API implemented here.

@Kubuxu
Copy link
Member Author

Kubuxu commented Nov 19, 2017

@lgierth agreed

@momack2 momack2 added this to In Progress in ipfs/go-ipfs May 9, 2019
@tssa88
Copy link

tssa88 commented Aug 21, 2023

Hi! Any update on this? Currently, how can I use dht/findprovs from shell? Is it even possible?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
ipfs/go-ipfs
In Progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants