Change Freeze stops de-peering at exchanges
Snubs (refused and torn-down sessions at exchanges) are part of the market rule now, so Change Freeze and puzzles have none; On-call is unchanged.
This commit is contained in:
parent
9b7b1c150c
commit
e17ddc247b
12 changed files with 34 additions and 15 deletions
|
|
@ -1,12 +1,13 @@
|
|||
/* Big networks sometimes refuse to peer in a particular city, for a while. Each (network, city)
|
||||
pair gets a stable verdict per window, derived from a hash, so asking again does not reroll it. */
|
||||
pair gets a stable verdict per window, derived from a hash, so asking again does not reroll it.
|
||||
It is part of the market: without one (Change Freeze, puzzles), nobody refuses or drops a session. */
|
||||
const SNUB_WIN=150,SNUB_P=0.22;
|
||||
const SNUB_IX=[tr('peering_policy.only_peers_over_pnis_in_this'),tr('peering_policy.their_ix_port_here_is_full'),tr('peering_policy.moved_everything_in_this_city_to'),tr('peering_policy.the_peering_coordinator_for_this'),tr('peering_policy.their_policy_here_says_ix_peering')];
|
||||
const SNUB_ALL=[tr('peering_policy.not_accepting_new_peers_in_this'),tr('peering_policy.region_frozen_while_they_renegotiate'),tr('peering_policy.their_routers_in_this_city_are'),tr('peering_policy.already_reach_you_through_your'),tr('peering_policy.their_lawyers_are_reviewing_every'),tr('peering_policy.a_new_vp_wants_to_monetise')];
|
||||
function hstr(t){let h=2166136261;for(let i=0;i<t.length;i++){h^=t.charCodeAt(i);h=Math.imul(h,16777619);}return h>>>0;}
|
||||
function bigPeer(n){return !!n&&n.pol==='selective'&&n.share>=0.03;}
|
||||
function snub(id,c){
|
||||
const n=NET[id];if(!c||!bigPeer(n)||!S||S.myIx[c])return null;
|
||||
const n=NET[id];if(!c||!bigPeer(n)||!S||S.myIx[c]||!rule('market'))return null;
|
||||
const off=hstr(id+c)%SNUB_WIN,ep=Math.floor((S.day+off)/SNUB_WIN),h=hstr(S.asn+'|'+id+'|'+c+'|'+ep);
|
||||
if(h%1000>=SNUB_P*1000)return null;
|
||||
const all=(h>>>10)%5<2,list=all?SNUB_ALL:SNUB_IX;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue