@@ -9,7 +9,6 @@ const { FIREWALL, ERROR } = require('./constants')
9
9
const { unslabbedHash } = require ( './crypto' )
10
10
const SecurePayload = require ( './secure-payload' )
11
11
const Holepuncher = require ( './holepuncher' )
12
- const DebuggingStream = require ( 'debugging-stream' )
13
12
const { isPrivate } = require ( 'bogon' )
14
13
const { ALREADY_LISTENING , NODE_DESTROYED } = require ( './errors' )
15
14
@@ -304,12 +303,7 @@ module.exports = class Server extends EventEmitter {
304
303
if ( remoteChanging ) remoteChanging . catch ( safetyCatch )
305
304
} else {
306
305
hs . rawStream . connect ( socket , remotePayload . udx . id , port , host )
307
-
308
- const rawStream = this . dht . _debugStream !== null
309
- ? new DebuggingStream ( hs . rawStream , this . dht . _debugStream )
310
- : hs . rawStream
311
-
312
- hs . encryptedSocket = this . createSecretStream ( false , rawStream , {
306
+ hs . encryptedSocket = this . createSecretStream ( false , hs . rawStream , {
313
307
handshake : h ,
314
308
keepAlive : this . dht . connectionKeepAlive
315
309
} )
@@ -363,11 +357,6 @@ module.exports = class Server extends EventEmitter {
363
357
return null
364
358
}
365
359
366
- if ( this . dht . _debugHandshakeLatency !== null ) {
367
- const [ start , end ] = this . dht . _debugHandshakeLatency
368
- await sleep ( start + Math . round ( Math . random ( ) * ( end - start ) ) )
369
- }
370
-
371
360
const h = handshake . final ( )
372
361
373
362
if ( error !== ERROR . NONE ) {
@@ -640,11 +629,7 @@ module.exports = class Server extends EventEmitter {
640
629
. on ( 'close' , ( ) => hs . relaySocket . destroy ( ) )
641
630
. connect ( socket , remoteId , remotePort , remoteHost )
642
631
643
- const rawStream = this . dht . _debugStream !== null
644
- ? new DebuggingStream ( hs . rawStream , this . dht . _debugStream )
645
- : hs . rawStream
646
-
647
- hs . encryptedSocket = this . createSecretStream ( false , rawStream , { handshake : h } )
632
+ hs . encryptedSocket = this . createSecretStream ( false , hs . rawStream , { handshake : h } )
648
633
649
634
this . onconnection ( hs . encryptedSocket )
650
635
} )
@@ -685,10 +670,6 @@ function defaultCreateSecretStream (isInitiator, rawStream, opts) {
685
670
return new NoiseSecretStream ( isInitiator , rawStream , opts )
686
671
}
687
672
688
- function sleep ( ms ) {
689
- return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) )
690
- }
691
-
692
673
function onlyPrivateHosts ( addr ) {
693
674
return isPrivate ( addr . host )
694
675
}
0 commit comments