-
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
examples: connect to all peers in example mdns chat app #1798
examples: connect to all peers in example mdns chat app #1798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of #1661, we shouldn't be discovering ourselves. Is this check really needed?
In #1661 this issue is fixed and go.mod in examples is upgraded recently with the new version of libp2p, so I don't think these changes are required. |
examples/chat-with-mdns/main.go
Outdated
fmt.Println("Connected to:", peer) | ||
for { // allows multiple peers to join | ||
peer := <-peerChan // will block untill we discover a peer | ||
if peer.ID != host.ID() { // cannot connect to itself |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, as of #1661.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should rebase/merge master. You’re changes would regress the examples :)
examples/chat-with-mdns/main.go
Outdated
"github.com/libp2p/go-libp2p/core/protocol" | ||
"github.com/libp2p/go-libp2p-core/crypto" | ||
"github.com/libp2p/go-libp2p-core/network" | ||
"github.com/libp2p/go-libp2p-core/protocol" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want to undo this. This is referencing the old interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did rebase
898331b
to
7b7e3ce
Compare
…ck to discovering.
rebase was executed correctly
examples: use circuitv2 in relay example (#1795) * Updated relay example to use circuit-v2 * fixed incorrect import * updated test fixture * upgrade dependencies * merged upstream * Implemented suggested changes in upstream PR * Implemented suggested changes in upstream PR roadmap: fix header level on "Mid Q4" (#1818) examples: connect to all peers in example mdns chat app (#1798) * Fixed bug in example mdns chat app. * Added continue, so that if connection to other host fails, will go back to discovering.
Fixes #1797
Added if condition to make sure it is not attempting self dial .
Added for loop so that multiple peers can join chat .