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

Add findprovs#47

Open
Kubuxu wants to merge 1 commit into
masterfrom
feat/findprovs
Open

Add findprovs#47
Kubuxu wants to merge 1 commit into
masterfrom
feat/findprovs

Conversation

@Kubuxu

@Kubuxu Kubuxu commented Mar 25, 2017

Copy link
Copy Markdown
Member

No description provided.

@Kubuxu Kubuxu added the status/in-progress In progress label Mar 25, 2017

@hsanjuan hsanjuan left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread shell.go
return nil, resp.Error
}

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

Copy link
Copy Markdown
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

Comment thread shell.go

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

ghost commented Nov 18, 2017

Copy link
Copy Markdown

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

Kubuxu commented Nov 19, 2017

Copy link
Copy Markdown
Member Author

@lgierth agreed

@tas88-sys

Copy link
Copy Markdown

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

None yet

Development

Successfully merging this pull request may close these issues.

4 participants