This repository was archived by the owner on Aug 23, 2019. It is now read-only.
File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,6 @@ class Hop extends EE {
87
87
return this . _writeErr ( streamHandler , constants . RESPONSE . HOP . CANT_CONNECT_TO_SELF , cb )
88
88
}
89
89
90
- if ( ! this . active && ! utils . isPeerConnected ( dstMa . getPeerId ( ) ) ) {
91
- return this . _writeErr ( streamHandler , constants . RESPONSE . HOP . NO_CONN_TO_DST , cb )
92
- }
93
-
94
90
cb ( null , dstMa )
95
91
} )
96
92
}
@@ -107,7 +103,17 @@ class Hop extends EE {
107
103
this . swarm . handle ( multicodec . hop , ( proto , conn ) => {
108
104
const streamHandler = new StreamHandler ( conn , 1000 * 60 )
109
105
waterfall ( [
110
- ( cb ) => this . _readDstAddr ( streamHandler , cb ) ,
106
+ ( cb ) => this . _readDstAddr ( streamHandler , ( err , dstMa ) => {
107
+ if ( err ) {
108
+ return cb ( err )
109
+ }
110
+
111
+ if ( ! this . active && ! utils . isPeerConnected ( dstMa . getPeerId ( ) ) ) {
112
+ return this . _writeErr ( streamHandler , constants . RESPONSE . HOP . NO_CONN_TO_DST , cb )
113
+ }
114
+
115
+ cb ( null , dstMa )
116
+ } ) ,
111
117
( dstMa , cb ) => {
112
118
this . _readSrcAddr ( streamHandler , ( err , srcMa ) => {
113
119
cb ( err , dstMa , srcMa )
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- require ( 'setimmediate ' )
3
+ const setImmediate = require ( 'async/setImmediate ' )
4
4
5
5
const EE = require ( 'events' ) . EventEmitter
6
6
const Buffer = require ( 'safe-buffer' ) . Buffer
You can’t perform that action at this time.
0 commit comments