Skip to content

Commit

Permalink
chore: lint identify (libp2p#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Mar 3, 2023
1 parent 528a65a commit 6ff2e6b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/identify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as lp from 'it-length-prefixed'
import { pipe } from 'it-pipe'
import first from 'it-first'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { multiaddr, protocols } from '@multiformats/multiaddr'
import { Multiaddr, multiaddr, protocols } from '@multiformats/multiaddr'
import { Identify } from './pb/message.js'
import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'
import {
Expand Down Expand Up @@ -112,7 +112,7 @@ export class IdentifyService implements Startable {
const { peerId } = evt.detail

if (this.components.peerId.equals(peerId)) {
void this.pushToPeerStore().catch(err => log.error(err))
void this.pushToPeerStore().catch(err => { log.error(err) })
}
})

Expand All @@ -121,16 +121,16 @@ export class IdentifyService implements Startable {
const { peerId } = evt.detail

if (this.components.peerId.equals(peerId)) {
void this.pushToPeerStore().catch(err => log.error(err))
void this.pushToPeerStore().catch(err => { log.error(err) })
}
})
}

isStarted () {
isStarted (): boolean {
return this.started
}

async start () {
async start (): Promise<void> {
if (this.started) {
return
}
Expand Down Expand Up @@ -216,7 +216,7 @@ export class IdentifyService implements Startable {
/**
* Calls `push` on all peer connections
*/
async pushToPeerStore () {
async pushToPeerStore (): Promise<void> {
// Do not try to push if we are not running
if (!this.isStarted()) {
return
Expand Down Expand Up @@ -388,7 +388,7 @@ export class IdentifyService implements Startable {
* Sends the `Identify` response with the Signed Peer Record
* to the requesting peer over the given `connection`
*/
async _handleIdentify (data: IncomingStreamData) {
async _handleIdentify (data: IncomingStreamData): Promise<void> {
const { connection, stream } = data
const timeoutController = new TimeoutController(this.init.timeout)

Expand Down Expand Up @@ -440,7 +440,7 @@ export class IdentifyService implements Startable {
/**
* Reads the Identify Push message from the given `connection`
*/
async _handlePush (data: IncomingStreamData) {
async _handlePush (data: IncomingStreamData): Promise<void> {
const { connection, stream } = data
const timeoutController = new TimeoutController(this.init.timeout)

Expand Down Expand Up @@ -528,7 +528,7 @@ export class IdentifyService implements Startable {
/**
* Takes the `addr` and converts it to a Multiaddr if possible
*/
static getCleanMultiaddr (addr: Uint8Array | string | null | undefined) {
static getCleanMultiaddr (addr: Uint8Array | string | null | undefined): Multiaddr | undefined {
if (addr != null && addr.length > 0) {
try {
return multiaddr(addr)
Expand Down

0 comments on commit 6ff2e6b

Please sign in to comment.