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

Commit 79d2e69

Browse files
author
Alan Shaw
committed
fix: create HTTP servers in series
In Windows this consistently fails because of port collisions when using ethemeral ports. License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 0e0d1dd commit 79d2e69

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
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 {

0 commit comments

Comments
 (0)