Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 970a269

Browse files
author
Alan Shaw
authored
fix: create HTTP servers in series (#2388)
In Windows this consistently fails because of port collisions when using ethemeral ports. License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 11ba101 commit 970a269

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/http/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ function hapiInfoToMultiaddr (info) {
2323
return toMultiaddr(uri)
2424
}
2525

26-
function serverCreator (serverAddrs, createServer, ipfs) {
26+
async function serverCreator (serverAddrs, createServer, ipfs) {
2727
serverAddrs = serverAddrs || []
2828
// just in case the address is just string
2929
serverAddrs = Array.isArray(serverAddrs) ? serverAddrs : [serverAddrs]
3030

31-
const processServer = async address => {
31+
const servers = []
32+
for (const address of serverAddrs) {
3233
const addrParts = address.split('/')
3334
const server = await createServer(addrParts[2], addrParts[4], ipfs)
3435
await server.start()
3536
server.info.ma = hapiInfoToMultiaddr(server.info)
36-
return server
37+
servers.push(server)
3738
}
38-
39-
return Promise.all(serverAddrs.map(processServer))
39+
return servers
4040
}
4141

4242
class HttpApi {

test/http-api/inject/dns.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ module.exports = (http) => {
2020
expect(res.result).to.have.property('Path')
2121
})
2222

23-
it('resolve ipfs.enstest.eth ENS', async () => {
23+
it('resolve ipfs.enstest.eth ENS', async function () {
2424
const res = await api.inject({
2525
method: 'GET',
2626
url: '/api/v0/dns?arg=ipfs.enstest.eth'
2727
})
2828

29+
// TODO: eth.link domains have no SLA yet and are liable to be down...
30+
// Remove skip when reliable!
31+
if (res.statusCode === 500) {
32+
return this.skip()
33+
}
34+
2935
expect(res.result).to.have.property('Path')
3036
})
3137
})

0 commit comments

Comments
 (0)