5 * Created by Victor Grishchenko on 10/6/09.
6 * Copyright 2009-2012 TECHNISCHE UNIVERSITEIT DELFT. All rights reserved.
13 using namespace swift;
15 class SimpleSelector : public PeerSelector {
16 typedef std::pair<Address,Sha1Hash> memo_t;
17 typedef std::deque<memo_t> peer_queue_t;
22 void AddPeer (const Address& addr, const Sha1Hash& root) {
23 peers.push_front(memo_t(addr,root)); //,root.fingerprint() !!!
25 Address GetPeer (const Sha1Hash& for_root) {
26 //uint32_t fp = for_root.fingerprint();
27 for(peer_queue_t::iterator i=peers.begin(); i!=peers.end(); i++)
28 if (i->second==for_root) {
29 i->second = Sha1Hash::ZERO; // horror TODO rewrite
30 sockaddr_in ret = i->first;
31 while (peers.begin()->second==Sha1Hash::ZERO)