Changeset 13541 for branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
- Timestamp:
- 01/18/16 15:15:19 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
r13538 r13541 9 9 namespace DistributedGA.Core.Implementation { 10 10 public class WcfPeerListManager : IPeerListManager { 11 private string SERVER_STRING= null;11 private string serverString = null; 12 12 13 13 private IContactService client = null; … … 19 19 20 20 public void Init(PeerInfo source) { 21 SERVER_STRING= ConfigurationManager.AppSettings["ContactServerURL"];21 serverString = ConfigurationManager.AppSettings["ContactServerURL"]; 22 22 client = CreateClient(); 23 23 myself = source; … … 41 41 private IContactService CreateClient() { 42 42 var binding = new BasicHttpBinding(); 43 var endpoint = new EndpointAddress( SERVER_STRING);43 var endpoint = new EndpointAddress(serverString); 44 44 var myChannelFactory = new ChannelFactory<IContactService>(binding, endpoint); 45 45 … … 52 52 //communicate with 10% of the network 53 53 int noOfPeers = allPeers.Count / 10; 54 List< Int32> indexList = GetRandomItemIndexes(noOfPeers, 0, allPeers.Count - 1);54 List<int> indexList = GetRandomItemIndexes(noOfPeers, 0, allPeers.Count - 1); 55 55 List<PeerInfo> res = new List<PeerInfo>(); 56 foreach ( Int32index in indexList) {56 foreach (int index in indexList) { 57 57 res.Add(allPeers.ElementAt(index)); 58 58 } … … 60 60 } 61 61 62 private List< Int32> GetRandomItemIndexes(int noOfItems, int minValue, int maxValue) {63 List< Int32> res = new List<Int32>();62 private List<int> GetRandomItemIndexes(int noOfItems, int minValue, int maxValue) { 63 List<int> res = new List<int>(); 64 64 Random rnd = new Random(); 65 65 int tmp = -1;
Note: See TracChangeset
for help on using the changeset viewer.