rename to roomrpc, fix tunneled typo
This commit is contained in:
parent
ee61749918
commit
713de8f489
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
// so it will be an incomming tunnel client.
|
||||
// since this calls exit() - if no client connects it will not exit
|
||||
sbot.on("rpc:connect", (remote, isClient) => {
|
||||
console.warn("tunneld connection to simple client!")
|
||||
console.warn("tunneled connection to simple client!")
|
||||
|
||||
// leave after 3 seconds (give the other party time to call ping)
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -12,9 +12,9 @@ module.exports = {
|
|||
ready()
|
||||
},
|
||||
|
||||
after: (t, client, roomSrvRpc, exit) => {
|
||||
after: (t, client, roomrpc, exit) => {
|
||||
newConnections++
|
||||
t.comment('client new connection!' + roomSrvRpc.id)
|
||||
t.comment('client new connection!' + roomrpc.id)
|
||||
t.comment('total connections:' + newConnections)
|
||||
|
||||
if (newConnections > 1) {
|
||||
|
@ -25,37 +25,37 @@ module.exports = {
|
|||
|
||||
// log all new endpoints
|
||||
pull(
|
||||
roomSrvRpc.tunnel.endpoints(),
|
||||
roomrpc.tunnel.endpoints(),
|
||||
pull.drain(el => {
|
||||
t.comment("from roomsrv:", el)
|
||||
})
|
||||
)
|
||||
|
||||
roomSrvRpc.tunnel.isRoom((err, yes) => {
|
||||
roomrpc.tunnel.isRoom((err, yes) => {
|
||||
t.error(err, "tunnel.isRoom failed")
|
||||
t.equal(yes, true, "expected isRoom to return true!")
|
||||
|
||||
t.comment("peer is indeed a room!")
|
||||
|
||||
// announce ourselves to the room/tunnel
|
||||
roomSrvRpc.tunnel.announce().then((ret) => {
|
||||
roomrpc.tunnel.announce().then((ret) => {
|
||||
t.comment('announced!')
|
||||
|
||||
// put there by the go test process
|
||||
let roomHandle = readFileSync('endpoint_through_room.txt').toString()
|
||||
t.comment("connecting to room handle:" + roomHandle)
|
||||
|
||||
client.conn.connect(roomHandle, (err, tunneldRpc) => {
|
||||
client.conn.connect(roomHandle, (err, tunneledrpc) => {
|
||||
t.error(err, "connected")
|
||||
t.comment("got tunnel to:", tunneldRpc.id)
|
||||
t.comment("got tunnel to:", tunneledrpc.id)
|
||||
|
||||
// check the tunnel connection works
|
||||
tunneldRpc.tunnel.ping((err, timestamp) => {
|
||||
tunneledrpc.tunnel.ping((err, timestamp) => {
|
||||
t.error(err, "ping over the tunnel")
|
||||
t.true(timestamp > 0, "ping returns a timestamp")
|
||||
t.comment("ping:"+timestamp)
|
||||
|
||||
roomSrvRpc.tunnel.leave().then((ret) => {
|
||||
roomrpc.tunnel.leave().then((ret) => {
|
||||
t.comment('left room... exiting in 1s')
|
||||
setTimeout(exit, 1000)
|
||||
}).catch((err) => {
|
||||
|
@ -68,4 +68,4 @@ module.exports = {
|
|||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = {
|
|||
|
||||
after: (t, sbot, rpc, exit) => {
|
||||
sbot.on("rpc:connect", (remote, isClient) => {
|
||||
console.warn("tunneld connection to simple client!")
|
||||
console.warn("tunneled connection to simple client!")
|
||||
|
||||
// check the tunnel connection works
|
||||
remote.testing.working((err, ok) => {
|
||||
|
|
|
@ -15,9 +15,9 @@ module.exports = {
|
|||
ready()
|
||||
},
|
||||
|
||||
after: (t, client, roomSrvRpc, exit) => {
|
||||
after: (t, client, roomrpc, exit) => {
|
||||
newConnections++
|
||||
t.comment('client new connection!' + roomSrvRpc.id)
|
||||
t.comment('client new connection!' + roomrpc.id)
|
||||
t.comment('total connections:' + newConnections)
|
||||
|
||||
if (newConnections > 1) {
|
||||
|
@ -28,32 +28,32 @@ module.exports = {
|
|||
|
||||
// log all new endpoints
|
||||
pull(
|
||||
roomSrvRpc.tunnel.endpoints(),
|
||||
roomrpc.tunnel.endpoints(),
|
||||
pull.drain(el => {
|
||||
t.comment("from roomsrv:" + JSON.stringify(el))
|
||||
})
|
||||
)
|
||||
|
||||
// announce ourselves to the room/tunnel
|
||||
roomSrvRpc.tunnel.announce().then((ret) => {
|
||||
roomrpc.tunnel.announce().then((ret) => {
|
||||
t.comment('announced!')
|
||||
|
||||
// put there by the go test process
|
||||
let roomHandle = readFileSync('endpoint_through_room.txt').toString()
|
||||
t.comment("connecting to room handle:", roomHandle)
|
||||
|
||||
client.conn.connect(roomHandle, (err, tunneldRpc) => {
|
||||
client.conn.connect(roomHandle, (err, tunneledrpc) => {
|
||||
t.error(err, 'connect through room')
|
||||
t.comment("got tunnel to:", tunneldRpc.id)
|
||||
t.comment("got tunnel to:", tunneledrpc.id)
|
||||
|
||||
// check the tunnel connection works
|
||||
tunneldRpc.testing.working((err, ok) => {
|
||||
tunneledrpc.testing.working((err, ok) => {
|
||||
t.error(err, 'testing.working didnt error')
|
||||
t.true(ok, 'testing.working is true')
|
||||
|
||||
// start leaving after 2s
|
||||
setTimeout(() => {
|
||||
roomSrvRpc.tunnel.leave().then((ret) => {
|
||||
roomrpc.tunnel.leave().then((ret) => {
|
||||
t.comment('left room... exiting in 3s')
|
||||
setTimeout(exit, 3000)
|
||||
}).catch((err) => {
|
||||
|
@ -66,4 +66,4 @@ module.exports = {
|
|||
t.error(err, 'announce on server')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue