File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { randomBytes } from '@libp2p/crypto'
1
2
import { serviceCapabilities } from '@libp2p/interface'
2
3
import { AdaptiveTimeout } from '@libp2p/utils/adaptive-timeout'
3
4
import { byteStream } from 'it-byte-stream'
@@ -9,6 +10,7 @@ const DEFAULT_PING_INTERVAL_MS = 10000
9
10
const PROTOCOL_VERSION = '1.0.0'
10
11
const PROTOCOL_NAME = 'ping'
11
12
const PROTOCOL_PREFIX = 'ipfs'
13
+ const PING_LENGTH = 32
12
14
13
15
export interface ConnectionMonitorInit {
14
16
/**
@@ -103,10 +105,10 @@ export class ConnectionMonitor implements Startable {
103
105
start = Date . now ( )
104
106
105
107
await Promise . all ( [
106
- bs . write ( new Uint8Array ( 1 ) , {
108
+ bs . write ( randomBytes ( PING_LENGTH ) , {
107
109
signal
108
110
} ) ,
109
- bs . read ( 1 , {
111
+ bs . read ( PING_LENGTH , {
110
112
signal
111
113
} )
112
114
] )
You can’t perform that action at this time.
0 commit comments