Skip to content

Commit

Permalink
docs(examples): fix dial function name and multiaddr variable name in…
Browse files Browse the repository at this point in the history
… echo and chat dialer/listener examples (#109)
  • Loading branch information
chrisbratlien authored and daviddias committed Jul 11, 2017
1 parent f877609 commit 019cd47
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/chat/src/dialer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ async.parallel([
], (err, ids) => {
if (err) throw err
const peerDialer = new PeerInfo(ids[0])
peerDialer.multiaddr.add('/ip4/0.0.0.0/tcp/0')
peerDialer.multiaddrs.add('/ip4/0.0.0.0/tcp/0')
const nodeDialer = new Node(peerDialer)

const peerListener = new PeerInfo(ids[1])
idListener = ids[1]
peerListener.multiaddr.add('/ip4/127.0.0.1/tcp/10333')
peerListener.multiaddrs.add('/ip4/127.0.0.1/tcp/10333')
nodeDialer.start((err) => {
if (err) {
throw err
Expand All @@ -47,7 +47,7 @@ async.parallel([
console.log(ma.toString() + '/ipfs/' + idListener.toB58String())
})

nodeDialer.dialByPeerInfo(peerListener, '/chat/1.0.0', (err, conn) => {
nodeDialer.dial(peerListener, '/chat/1.0.0', (err, conn) => {
if (err) {
throw err
}
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/src/libp2p-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const spdy = require('libp2p-spdy')
const KadDHT = require('libp2p-kad-dht')
const multiplex = require('libp2p-multiplex')
const secio = require('libp2p-secio')
const libp2p = require('../..')
const libp2p = require('../../..')

function mapMuxers (list) {
return list.map((pref) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/src/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PeerId.createFromJSON(require('./peer-id-listener'), (err, idListener) => {
throw err
}
const peerListener = new PeerInfo(idListener)
peerListener.multiaddr.add('/ip4/0.0.0.0/tcp/10333')
peerListener.multiaddrs.add('/ip4/0.0.0.0/tcp/10333')
const nodeListener = new Node(peerListener)

nodeListener.start((err) => {
Expand Down
6 changes: 3 additions & 3 deletions examples/echo/src/dialer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ async.parallel([
// Dialer
const dialerId = ids[0]
const dialerPeerInfo = new PeerInfo(dialerId)
dialerPeerInfo.multiaddr.add('/ip4/0.0.0.0/tcp/0')
dialerPeerInfo.multiaddrs.add('/ip4/0.0.0.0/tcp/0')
const dialerNode = new Node(dialerPeerInfo)

// Peer to Dial
const listenerPeerInfo = new PeerInfo(ids[1])
const listenerId = ids[1]
const listenerMultiaddr = '/ip4/127.0.0.1/tcp/10333/ipfs/' +
listenerId.toB58String()
listenerPeerInfo.multiaddr.add(listenerMultiaddr)
listenerPeerInfo.multiaddrs.add(listenerMultiaddr)

dialerNode.start((err) => {
if (err) { throw err }
Expand All @@ -38,7 +38,7 @@ async.parallel([
'/ipfs/' + dialerId.toB58String()))

console.log('Dialing to peer:', listenerMultiaddr.toString())
dialerNode.dialByPeerInfo(listenerPeerInfo, '/echo/1.0.0', (err, conn) => {
dialerNode.dial(listenerPeerInfo, '/echo/1.0.0', (err, conn) => {
if (err) { throw err }

console.log('nodeA dialed to nodeB on protocol: /echo/1.0.0')
Expand Down
2 changes: 1 addition & 1 deletion examples/echo/src/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ series([
},
(cb) => {
const listenerPeerInfo = new PeerInfo(listenerId)
listenerPeerInfo.multiaddr.add('/ip4/0.0.0.0/tcp/10333')
listenerPeerInfo.multiaddrs.add('/ip4/0.0.0.0/tcp/10333')
listenerNode = new Node(listenerPeerInfo)

listenerNode.swarm.on('peer-mux-established', (peerInfo) => {
Expand Down

0 comments on commit 019cd47

Please sign in to comment.