use warmed up connection + test

This commit is contained in:
David Dias
2015-09-22 17:27:37 +01:00
parent 8e8d8e9093
commit 59b00f6886
2 changed files with 54 additions and 3 deletions

View File

@ -79,10 +79,10 @@ function Swarm (peerInfo) {
// if it is and no protocol was selected, do nothing and call and empty callback
if (self.conns[peerInfo.id.toB58String()]) {
console.log('Had conn warmed up')
if (protocol) {
multistreamHandshake(self.conns[peerInfo.id.toB58String()])
self.conns[peerInfo.id.toB58String()] = undefined
delete self.conns[peerInfo.id.toB58String()]
return
} else {
return callback()
@ -208,7 +208,6 @@ function Swarm (peerInfo) {
// internals
function listen (conn) {
console.log('Received new connection')
// TODO apply upgrades
// TODO then add StreamMuxer if available (and point streams from muxer to userProtocolMuxer)