Recover idle radio scanning and reject stale sync progress responses

This commit is contained in:
alberto committed 2026-10-17 10:19:33 +02:00
1 parent 573e0aa24e
commit c0204f6b02
9 files changed
+43 -10

No files matched your search

+6
View File
@@ -28,3 +28,9 @@ test('an unsuccessful radio start stays visible until its temporary profile has
const job=ops.start({peer:'N0PEER',client,run:async()=>{throw Error('Modem not ready');}});await turn();assert.equal(ops.get(job.id).state,'restoring');assert.equal(ops.get(job.id).active,true);
client.job.restoring=false;await ops.update(ops.jobs.get(job.id));assert.equal(ops.get(job.id).state,'failed');assert.equal(ops.get(job.id).active,false);
});
test('progress stays bound to its first outgoing session when the partner connects again',async()=>{
let text='';const ops=new SyncOperations({logs:async()=>text}),j=ops.start({peer:'N0PEER',kind:'forwarding',run:async()=>{}});await turn();
const stamp=date=>date.toISOString().slice(2,10).replaceAll('-','')+' '+date.toISOString().slice(11,19),first=stamp(new Date(j.startedAt)),later=stamp(new Date(Date.parse(j.startedAt)+60000));
text=first+' |N0PEER Connecting to BBS N0PEER';const job=ops.jobs.get(j.id);await ops.update(job);const bound=job.sessionStartedAt;assert.ok(bound);
text+='\n'+later+' |N0PEER Connecting to BBS N0PEER\n'+later+' <N0PEER *** Connected to N0PEER';await ops.update(job);assert.equal(job.sessionStartedAt,bound);assert.notEqual(job.state,'connected');clearInterval(job.timer);
});