mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-01 21:42:14 +00:00
Initial Commit
This commit is contained in:
parent
a74aac6e11
commit
b1f7e65f18
@ -25,16 +25,14 @@ exports.inquiry = function (spdyConnection, cb) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// 0. open a stream
|
// 0. open a stream
|
||||||
// 1. negotiate /ipfs/identify/1.0.0
|
// 1. negotiate /ipfs/identify/1.0.0
|
||||||
// 2. check other peerId
|
// 2. check other peerId
|
||||||
// 3. reply back with cb(null, connection, peerId)
|
// 3. reply back with cb(null, connection, peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// peer asking which pairs ip:port does the other peer see
|
// peer asking which pairs ip:port does the other peer see
|
||||||
exports.whoAmI = function () {
|
exports.whoAmI = function () {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.start = function (peerSelf) {
|
exports.start = function (peerSelf) {
|
||||||
swarm.registerHandle('/ipfs/identify/1.0.0', function (ds) {
|
swarm.registerHandle('/ipfs/identify/1.0.0', function (ds) {
|
||||||
|
@ -14,7 +14,6 @@ var handles = []
|
|||||||
// set the listener
|
// set the listener
|
||||||
|
|
||||||
exports.listen = function () {
|
exports.listen = function () {
|
||||||
|
|
||||||
tcp.createServer(function (socket) {
|
tcp.createServer(function (socket) {
|
||||||
var ms = new Select()
|
var ms = new Select()
|
||||||
ms.handle(socket)
|
ms.handle(socket)
|
||||||
@ -63,7 +62,6 @@ exports.openStream = function (peer, protocol, cb) {
|
|||||||
|
|
||||||
// If no connection open yet, open it
|
// If no connection open yet, open it
|
||||||
if (!connections[peer.id.toB58String()]) {
|
if (!connections[peer.id.toB58String()]) {
|
||||||
|
|
||||||
// Establish a socket with one of the addresses
|
// Establish a socket with one of the addresses
|
||||||
var gotOne = false
|
var gotOne = false
|
||||||
async.eachSeries(peer.multiaddrs, function (multiaddr, callback) {
|
async.eachSeries(peer.multiaddrs, function (multiaddr, callback) {
|
||||||
@ -158,4 +156,3 @@ function registerHandles (spdyStream) {
|
|||||||
msH.addHandler(handle.protocol, handle.func)
|
msH.addHandler(handle.protocol, handle.func)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user