From 2d362d3bbcba3ff9a4d9ef9e2e794e407505e7aa Mon Sep 17 00:00:00 2001 From: Victor Grishchenko Date: Wed, 20 Jan 2010 18:11:45 +0100 Subject: [PATCH] fast-fix; todo: add options to seeder/hasher --- rarest1st.cpp | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 rarest1st.cpp diff --git a/rarest1st.cpp b/rarest1st.cpp deleted file mode 100644 index 16c9b8b..0000000 --- a/rarest1st.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * rarest1st.cpp - * serp++ - * - * Created by Victor Grishchenko on 3/6/09. - * Copyright 2009 Delft University of Technology. All rights reserved. - * - */ - - -char* Rarest1st::on_event (P2Channel& ch) { - if (!ch.peer_has) - return "nothing is known - cannot choose"; - feye i_need (ch.file->have,ch.peer_has->focus); - i_need.invert(); - i_need &= ch.peer_has; - if (i_need.clean()) - return "the peer has nothing we don't have"; - feye ladder[20]; - for(int i=P2TP_CHANNELS.begin(); i!=P2TP_CHANNELS.end(); i++) { - p2tp_channel* c = *i; - if (!c || !c->peer_has) - continue; - feye x = feye_and(c->peer_has,i_need); - for(int j=0; j<20 && !x.clean(); j++) { - feye xx(x); - x &= ladder[j]; - ladder[j] ^= xx; - } - } - feye not_rare (ch.peer_has->focus); - for(int i=20-1; i>0; i--) { - not_rare |= ladder[i]; - ladder[i-1] -= not_rare; - } - int pickfrom = 0; - while (ladder[pickfrom].clean() && pickfrom<20) - pickfrom++; - assert(pickfrom<20); - mlat spot = ladder[pickfrom].randomBit(); - ch->i_ackd.refocus(spot); - return NULL; -} -- 2.20.1