private NodePeer ConnectToHubInCache() { List <NodePeer> GoodHubs = GHubCache.Instance.HubCache.Where(foo => foo.isHub && foo.Queryable).ToList(); GHandshake hand; foreach (NodePeer p in GHubCache.Instance.HubCache) { hand = new GHandshake(p); var succ = hand.TryConnect(); if (succ) // we established a connection ! { p.AttachTo(hand); return(p); } else { cache.RemoveHub(p); // could not connect hub so we remove it from the case } } return(null); }
/** * Call the gwebcache to get a list of peer * try to connect to them , see if it is * a hub , IF NOT : * parse the try hubs header * */ public NodePeer Bootstrap() { List <NodePeer> hosts = GWebCache.Instance.PeersList; int count = 0; foreach (NodePeer p in hosts) { GHandshake hand = new GHandshake(p); var succ = hand.TryConnect(); count++; // we have a hub if (succ) { p.AttachTo(hand); return(p); } if (GHubCache.Instance.HubCacheSize > 0 && count > 10) { break; } } return(null); }
/** * Call the gwebcache to get a list of peer * try to connect to them , see if it is * a hub , IF NOT : * parse the try hubs header * */ public NodePeer Bootstrap() { List<NodePeer> hosts = GWebCache.Instance.PeersList; int count = 0; foreach(NodePeer p in hosts) { GHandshake hand = new GHandshake(p); var succ = hand.TryConnect(); count++; // we have a hub if (succ) { p.AttachTo (hand); return p; } if(GHubCache.Instance.HubCacheSize > 0 && count > 10) { break; } } return null; }
private NodePeer ConnectToHubInCache() { List<NodePeer> GoodHubs = GHubCache.Instance.HubCache.Where (foo => foo.isHub && foo.Queryable).ToList (); GHandshake hand; foreach (NodePeer p in GHubCache.Instance.HubCache) { hand = new GHandshake (p); var succ = hand.TryConnect (); if (succ) { // we established a connection ! p.AttachTo (hand); return p; } else { cache.RemoveHub (p); // could not connect hub so we remove it from the case } } return null; }