-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I was playing with chat example and ran into a couple of issues I hope you could help me with.
- After the following modification to
chat.rscode has been made:
diff --git a/examples/chat.rs b/examples/chat.rs
index 65f8589..245b495 100644
--- a/examples/chat.rs
+++ b/examples/chat.rs
@@ -158,10 +160,10 @@ fn main() {
},
Async::Ready(None) | Async::NotReady => {
if !listening {
- if let Some(a) = Swarm::listeners(&swarm).next() {
- println!("Listening on {:?}", a);
- listening = true;
- }
+ Swarm::listeners(&swarm).for_each(move |l| {
+ println!("Listening on {:?}", l);
+ });
+ listening = true;
}
break
}
the output became
Local peer id: PeerId("QmbdG1dRD9SmWeDud6M79mGfh6kwWqmtQT4G2a69VYv3pn")
Listening on "/ip4/127.0.0.1/tcp/64039"
Listening on "/ip6/::1/tcp/64039"
Listening on "/ip4/127.94.0.1/tcp/64039"
Listening on "/ip4/192.168.1.77/tcp/64039"
Listening on "/ip4/192.168.1.66/tcp/64039"
It seems that, despite it being set to listen IPv4 (libp2p::Swarm::listen_on(&mut swarm, "/ip4/0.0.0.0/tcp/0".parse().unwrap()).unwrap(); on line 141), the app is listening on an interface with IPv6 address assigned.
Am I missing something or I'm hitting a bug?
- Actually, my goal at that moment was to enable unix domain socket, so I added the following code:
diff --git a/examples/chat.rs b/examples/chat.rs
index 65f8589..59a9f61 100644
--- a/examples/chat.rs
+++ b/examples/chat.rs
@@ -139,6 +139,7 @@ fn main() {
// Listen on all interfaces and whatever port the OS assigns
libp2p::Swarm::listen_on(&mut swarm, "/ip4/0.0.0.0/tcp/0".parse().unwrap()).unwrap();
+ libp2p::Swarm::listen_on(&mut swarm, "/unix//tmp/aaa".parse().unwrap()).unwrap();
// Kick it off
let mut listening = false;
Somehow that led to a run time error
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnknownProtocolString', src/libcore/result.rs:1084:5
And if I used "/unix/aaa" instead, the error became
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MultiaddrNotSupported("/unix/buildmesh.QmPe33CVxLRYcBe62K4dKr7Lu4uUKgcKbMWz7TL8DT48aB")', src/libcore/result.rs:1084:5
Any idea what I missed there?
Thanks a lot in advance,
--Boris
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels