Clean up logging
This commit is contained in:
parent
cb64bc3213
commit
c025456bdd
|
@ -40,7 +40,7 @@ export function boot(ds: Ref, debug: boolean = false) {
|
|||
|
||||
function tryConnection(addr: G.RelayAddress): Promise<WebSocket> {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log('trying', addr);
|
||||
console.log('@syndicate-lang/ws-relay trying', addr);
|
||||
const ws = new WebSocket(addr.url);
|
||||
ws.binaryType = 'arraybuffer';
|
||||
ws.onopen = () => resolve(ws);
|
||||
|
@ -57,31 +57,28 @@ export function boot(ds: Ref, debug: boolean = false) {
|
|||
try {
|
||||
return { ws: await tryConnection(addr), addr };
|
||||
} catch (e) {
|
||||
console.log('attempt to contact', addr.url, 'failed with', e);
|
||||
console.log(
|
||||
'@syndicate-lang/ws-relay attempt to contact', addr.url, 'failed with', e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function wsConnect(addrs: G.RelayAddress[], k: (e: Ref, addr: G.RelayAddress) => void) {
|
||||
console.log('wsConnect', addrs);
|
||||
let counter = 0;
|
||||
new Supervisor({
|
||||
restartPolicy: SupervisorRestartPolicy.ALWAYS,
|
||||
}, () => ['wsRelay', fromJS(addrs), counter++], () => {
|
||||
console.log('try!', counter - 1);
|
||||
const facet = Turn.activeFacet;
|
||||
facet.preventInertCheck();
|
||||
|
||||
establishConnection(addrs).then(result => facet.turn(() => {
|
||||
if (result === null) {
|
||||
console.log('no successful connection');
|
||||
console.log('@syndicate-lang/ws-relay no successful connection');
|
||||
stop {}
|
||||
} else {
|
||||
const {ws, addr} = result;
|
||||
console.log('hey cool', addr);
|
||||
on stop {
|
||||
console.log('on stop triggered');
|
||||
ws.close();
|
||||
}
|
||||
ws.onclose = () => facet.turn(() => { stop {} });
|
||||
|
@ -104,7 +101,6 @@ export function boot(ds: Ref, debug: boolean = false) {
|
|||
}
|
||||
|
||||
function resolve(e: Ref, steps: N.RouteStep<Ref>[], k: (e: Ref) => void) {
|
||||
console.log('resolve', e, steps);
|
||||
if (steps.length === 0) {
|
||||
k(e);
|
||||
} else {
|
||||
|
@ -155,7 +151,6 @@ export function boot(ds: Ref, debug: boolean = false) {
|
|||
remoteStaticPublicKey: underlying(spec.key),
|
||||
preSharedKeys: preSharedKeys.map(underlying),
|
||||
});
|
||||
console.log('HANDSHAKE', H);
|
||||
let transportState: SaltyCrypto.TransportState | null = null;
|
||||
let responderSession: Ref | null = null;
|
||||
let relay: Relay.Relay | null = null;
|
||||
|
|
Loading…
Reference in New Issue