Skip to content

Commit 16e8a75

Browse files
authored
fix: remove unused dep (#374)
No need to wrap the query in race signal, it supports abort signals.
1 parent ccdd3be commit 16e8a75

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,8 @@
169169
"@chainsafe/is-ip": "^2.0.1",
170170
"@chainsafe/netmask": "^2.0.0",
171171
"@libp2p/interface": "^1.0.0",
172-
"@multiformats/dns": "^1.0.1",
172+
"@multiformats/dns": "^1.0.3",
173173
"multiformats": "^13.0.0",
174-
"race-signal": "^1.0.2",
175174
"uint8-varint": "^2.0.1",
176175
"uint8arrays": "^5.0.0"
177176
},

src/resolvers/dnsaddr.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { CodeError } from '@libp2p/interface'
22
import { dns, RecordType } from '@multiformats/dns'
3-
import { raceSignal } from 'race-signal'
43
import { multiaddr } from '../index.js'
54
import { getProtocol } from '../protocols-table.js'
65
import type { Resolver } from './index.js'
@@ -25,7 +24,7 @@ export interface DNSADDROptions extends AbortOptions {
2524
maxRecursiveDepth?: number
2625
}
2726

28-
export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddr (ma: Multiaddr, options: DNSADDROptions = {}): Promise<string[]> {
27+
export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddrResolver (ma: Multiaddr, options: DNSADDROptions = {}): Promise<string[]> {
2928
const recursionLimit = options.maxRecursiveDepth ?? MAX_RECURSIVE_DEPTH
3029

3130
if (recursionLimit === 0) {
@@ -35,12 +34,12 @@ export const dnsaddrResolver: Resolver<DNSADDROptions> = async function dnsaddr
3534
const [, hostname] = ma.stringTuples().find(([proto]) => proto === dnsaddrCode) ?? []
3635

3736
const resolver = options?.dns ?? dns()
38-
const result = await raceSignal(resolver.query(`_dnsaddr.${hostname}`, {
37+
const result = await resolver.query(`_dnsaddr.${hostname}`, {
3938
signal: options?.signal,
4039
types: [
4140
RecordType.TXT
4241
]
43-
}), options.signal)
42+
})
4443

4544
const peerId = ma.getPeerId()
4645
const output: string[] = []

test/resolvers.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ describe('multiaddr resolve', () => {
129129

130130
controller.abort()
131131

132-
await expect(resolvePromise).to.eventually.be.rejected().with.property('code', 'ABORT_ERR')
132+
await expect(resolvePromise).to.eventually.be.rejected()
133133
})
134134

135135
it('should abort resolving deeply nested records', async () => {

0 commit comments

Comments
 (0)