Skip to content
Snippets Groups Projects
Commit 1fce4ed0 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] Make tests pass since initial peersignal is delayed

parent 49c4011f
Branches
Tags
No related merge requests found
...@@ -131,7 +131,9 @@ function Node (dbName, options) { ...@@ -131,7 +131,9 @@ function Node (dbName, options) {
// Launching server // Launching server
that.server = server; that.server = server;
started = true; started = true;
next(); server.PeeringService.generateSelfPeer(server.conf, 0)
.then(() => next())
.catch(next)
}, },
function (next) { function (next) {
that.http = contacter(options.remoteipv4, options.remoteport); that.http = contacter(options.remoteipv4, options.remoteport);
......
...@@ -674,11 +674,12 @@ export const simpleWS2PNetwork: (s1: TestingServer, s2: TestingServer) => Promis ...@@ -674,11 +674,12 @@ export const simpleWS2PNetwork: (s1: TestingServer, s2: TestingServer) => Promis
const cluster1 = WS2PCluster.plugOn(s1._server) const cluster1 = WS2PCluster.plugOn(s1._server)
const cluster2 = WS2PCluster.plugOn(s2._server) const cluster2 = WS2PCluster.plugOn(s2._server)
const ws2ps = await cluster1.listen('localhost', port) const ws2ps = await cluster1.listen('localhost', port)
const ws2pc = await cluster2.connect('localhost', port, new WS2PServerMessageHandler(s2._server, cluster2), s1._server.conf.pair.pub) const connexionPromise = new Promise(res => {
await new Promise(res => {
ws2ps.on('newConnection', res) ws2ps.on('newConnection', res)
}) })
const ws2pc = await cluster2.connect('localhost', port, new WS2PServerMessageHandler(s2._server, cluster2), s1._server.conf.pair.pub)
await connexionPromise
w1 = await ws2ps.getConnection(clientPub) w1 = await ws2ps.getConnection(clientPub)
if (!w1) { if (!w1) {
throw "Connection coming from " + clientPub + " was not found" throw "Connection coming from " + clientPub + " was not found"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment