File tree 1 file changed +5
-12
lines changed
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { logger } from '@libp2p/logger'
2
2
import errCode from 'err-code'
3
3
import * as lp from 'it-length-prefixed'
4
4
import { pipe } from 'it-pipe'
5
- import drain from 'it-drain'
6
5
import first from 'it-first'
7
6
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
8
7
import { multiaddr , protocols } from '@multiformats/multiaddr'
@@ -191,16 +190,14 @@ export class IdentifyService implements Startable {
191
190
// make stream abortable
192
191
const source = abortableDuplex ( stream , timeoutController . signal )
193
192
194
- await pipe (
193
+ await source . sink ( pipe (
195
194
[ Identify . encode ( {
196
195
listenAddrs,
197
196
signedPeerRecord,
198
197
protocols
199
198
} ) ] ,
200
- lp . encode ( ) ,
201
- source ,
202
- drain
203
- )
199
+ lp . encode ( )
200
+ ) )
204
201
} catch ( err : any ) {
205
202
// Just log errors
206
203
log . error ( 'could not push identify update to peer' , err )
@@ -430,12 +427,8 @@ export class IdentifyService implements Startable {
430
427
// make stream abortable
431
428
const source = abortableDuplex ( stream , timeoutController . signal )
432
429
433
- await pipe (
434
- [ message ] ,
435
- lp . encode ( ) ,
436
- source ,
437
- drain
438
- )
430
+ const msgWithLenPrefix = pipe ( [ message ] , lp . encode ( ) )
431
+ await source . sink ( msgWithLenPrefix )
439
432
} catch ( err : any ) {
440
433
log . error ( 'could not respond to identify request' , err )
441
434
} finally {
You can’t perform that action at this time.
0 commit comments