Merge remote-tracking branch 'origin/main' into claude/fix-227
# Conflicts: # CHANGELOG.md # tests/standing-orders.test.js
This commit is contained in:
commit
0402cf5845
3 changed files with 22 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ All notable changes to this project are documented here. The project follows
|
|||
## [Unreleased]
|
||||
|
||||
- The intern's transit order has a new provider choice, Already connected: it only grows the transit you already buy at each POP, the smallest port first, and never signs a new provider, so several upstreams grow together and no customer's "no Cogentle" gets a surprise (#227).
|
||||
- The intern's PNI order now counts the traffic the PNI list shows at each POP, so it no longer orders a PNI where a network's own cache boxes already serve most of its traffic (#244).
|
||||
- Cities on the map now show how big they are: zoomed out, bigger cities are bigger dots and megacities glow; zoomed in, a city's skyline grows from a hut to a megacity's towers. When cities crowd together, the smaller ones step back to a dot until you zoom in, so the map stays readable, and exchanges you haven't joined are quieter tags.
|
||||
- DDoS attacks are realistic now: most are small, the big ones are rare, and their size no longer grows with your network, so a big network is no longer hit by floods larger than the internet's record. Attacks go after one customer (gamers and hosting attract the most) or one city's subscribers, last one to three days, and On-call sees about one a month (#242).
|
||||
- A flood now arrives on every port the internet reaches you on, so more POPs and more exits spread it thinner, and a port it fills slows every customer on it. Flowspec and scrubbing behind a full port can no longer empty it (#242).
|
||||
|
|
|
|||
|
|
@ -172,7 +172,10 @@ const OPS_RUN={
|
|||
for(const row of utilityPeers())for(const id of row.requests){S.peers[id+'@'+row.ix]=true;X.did('peer',row.ix);}},
|
||||
// Weekly too: every willing network above the threshold, at its own minimum size and lead time (#181).
|
||||
pni(X){if(S.day%7!==3)return;const b=pniBatch(null,opsP('pni','tier'));if(!b)return;const g=opsP('pni','g'),paid=opsP('pni','paid');
|
||||
const loc=q=>(R.cityDem[q.city]||0)*(NSH[q.net]||0);
|
||||
// The traffic a PNI there would take over: what your users at that POP send to the network today over transit, an
|
||||
// exchange or a PNI elsewhere, the same figure the PNI list shows. Not the city's whole demand: a network's own
|
||||
// cache boxes in that POP already serve most of it (#244).
|
||||
const loc=q=>pniVal(q.net,q.city).want;
|
||||
for(const q of b.orders.filter(q=>opsHere('pni',q.city)&&loc(q)>=g&&(paid||NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).sort((a,b)=>loc(b)-loc(a))){
|
||||
if(!X.can('pni',q.cost))break;if(X.pay('pni',()=>{if(!spend(q.cost))return false;pniPlace(q);return true;}))X.did('pni',q.city+' '+q.net);}},
|
||||
// Hand back smaller waves once a bigger link between the same cities carries the pair with a quarter to spare (#102).
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ test('PNI: weekly, big enough networks only, paid peering left out by default, a
|
|||
const { ev, errors } = game(t, "ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;compute()");
|
||||
hire(ev); on(ev, 'pni', { g: 5, tier: 1 }, 0);
|
||||
ev('S.day=17;S.pops.fra.bb.d=3000;S.pops.ams.bb={d:3000};compute()');
|
||||
const plan = JSON.parse(ev("JSON.stringify(pniBatch(null,1).orders.filter(q=>(R.cityDem[q.city]||0)*NSH[q.net]>=5&&(NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).map(q=>({k:q.city+q.net,cost:q.cost,tier:q.tier,big:pniBig(q.net)})))"));
|
||||
const plan = JSON.parse(ev("JSON.stringify(pniBatch(null,1).orders.filter(q=>pniVal(q.net,q.city).want>=5&&(NET[q.net].pol!=='paid'||paidFree(NET[q.net]))).map(q=>({k:q.city+q.net,cost:q.cost,tier:q.tier,big:pniBig(q.net)})))"));
|
||||
assert.ok(plan.length > 0);
|
||||
const c0 = cash(ev);
|
||||
shift(ev);
|
||||
|
|
@ -619,3 +619,19 @@ test('#227 transit "Already connected" grows the providers you have, the smalles
|
|||
assert.equal(ev("opsP('transit','prov')"), 'have');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#244 the PNI order counts the traffic the PNI list shows at that POP, not what cache boxes there already serve', t => {
|
||||
const { ev, errors } = game(t, "ACT.buildPop({city:'ham'});for(const c of ['fra','ham']){S.pops[c].rgen=mainRG(4);S.pops[c].routers=6;if(!S.pops[c].bb)ACT.launchBB({city:c});S.pops[c].bb.d=CITY[c].P*0.9;}UI.pending={a:'fra',b:'ham'};ACT.buildLink({tier:3});closeModal();ACT.buyTransit({city:'fra',net:'cog',tier:3});ACT.buyTransit({city:'ham',net:'cog',tier:3});for(let i=0;i<6;i++)S.caches.push({id:'nfx'+i,city:'ham',net:'nfx'});compute()");
|
||||
// Hamburg's users want a lot from NetChill, but its cache boxes there serve most of it: little is left for a PNI
|
||||
const whole = ev("(R.cityDem.ham||0)*NSH.nfx"), here = ev("pniVal('nfx','ham').want");
|
||||
assert.ok(whole >= 10 && here < 10, `whole demand ${whole}, left for a PNI ${here}`);
|
||||
hire(ev); on(ev, 'pni', { g: 10, tier: 0 }, 0);
|
||||
ev('S.day=Math.ceil((S.day+1)/7)*7+3'); shift(ev);
|
||||
assert.equal(ev("S.pni.some(p=>p.city==='ham'&&p.net==='nfx')"), false, 'no NetChill PNI in Hamburg for 2-odd Gbps');
|
||||
// without the cache boxes all of it goes over transit, and the same order does buy the PNI
|
||||
ev("S.caches=S.caches.filter(x=>x.city!=='ham');compute()");
|
||||
assert.ok(ev("pniVal('nfx','ham').want") >= 10);
|
||||
ev('S.day+=7'); shift(ev);
|
||||
assert.equal(ev("S.pni.some(p=>p.city==='ham'&&p.net==='nfx')"), true, 'ordered once the traffic is really there');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue