Skip to content

Commit

Permalink
Restart both server and client
Browse files Browse the repository at this point in the history
  • Loading branch information
freeall committed Mar 20, 2024
1 parent ebf2617 commit f3ffd2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion test/fixtures/server-through-relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ async function main () {
.on('open', () => console.log('socket_onopen'))
.on('close', () => console.log('socket_onclose'))
.on('error', err => console.log(`socket_onerror ${err.code}`))
setTimeout(() => socket.destroy(), 1000 + 10 * Math.random())
})
server.on('open', () => console.log('server_onopen'))
server.on('error', err => console.log(`server_onerror ${err.code}`))
Expand Down
13 changes: 10 additions & 3 deletions test/keet-relay-bug-hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const path = require('path')
// client.set keep-alive
// client - should reconnect when connection dies

test.solo('Client connects to Server and keeps reconnectings - with relay', { timeout: 0 }, async t => {
test.skip('Client connects to Server and keeps reconnectings - with relay', { timeout: 0 }, async t => {
// test.solo('Client connects to Server and keeps reconnectings - with relay', { timeout: 0 }, async t => {
t.plan(2000)

const { bootstrap } = await swarm(t)
Expand Down Expand Up @@ -70,7 +71,13 @@ test.solo('Client connects to Server and keeps reconnectings - with relay', { ti
t.pass('[server] Started. Now starting client')
startClient()
}
if (isSocketOpened) t.pass('[server] Socket connected')
if (isSocketOpened) {
t.pass('[server] Socket connected. Waiting 1..10 seconds, then killing server')
setTimeout(() => {
t.pass('[server] killed')
serverProcess.kill()
}, 1000 + 1000 * 10 * Math.random())
}
if (isSocketClosed) t.pass('[server] Socket closed')
if (isSocketError) console.error(data)
})
Expand All @@ -85,7 +92,7 @@ test.solo('Client connects to Server and keeps reconnectings - with relay', { ti
})
.on('close', () => {
t.pass('[client] Socket closed. reconnecting')
startClient()
startServer()
})
.on('error', err => console.error('[client] error', err))
}
Expand Down

0 comments on commit f3ffd2d

Please sign in to comment.