- Timestamp:
- 06/29/16 15:28:47 (9 years ago)
- Location:
- branches/thasling/DistributedGA/DistributedGA.Core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.Core
- Property svn:ignore
-
old new 1 1 bin 2 2 obj 3 DistributedGA.Core.csproj.user
-
- Property svn:ignore
-
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs
r13947 r13956 29 29 30 30 31 public void Init(string lanIpPrefix, string contactServerUrl ) {31 public void Init(string lanIpPrefix, string contactServerUrl, string problemInstance, int messageCacheCapacity, int communicationRate) { 32 32 try { 33 33 ownInstance = new PeerInfo() { 34 34 IpAddress = GetInternalIpAddress(lanIpPrefix), 35 35 Port = 0, 36 ProblemInstance = "TestProblem"36 ProblemInstance = problemInstance 37 37 }; // TODO: get own peerinfo 38 38 39 39 writeQueue = new SizedConcurrentQueue<byte[]>(); 40 40 readQueue = new SizedConcurrentQueue<byte[]>(); 41 writeQueue.Limit = 1000;41 writeQueue.Limit = messageCacheCapacity; 42 42 readQueue.Limit = writeQueue.Limit; 43 43 … … 47 47 48 48 peerListManager = new WcfPeerListManager(); 49 peerListManager.Init(ownInstance, contactServerUrl );49 peerListManager.Init(ownInstance, contactServerUrl, communicationRate); 50 50 51 51 sender = new WcfMessageSender(); 52 sender.Init(ownInstance );52 sender.Init(ownInstance, messageCacheCapacity); 53 53 54 54 } … … 141 141 } 142 142 } 143 143 144 } 144 145 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/TestPeerListManager.cs
r13918 r13956 34 34 35 35 } 36 37 #region IPeerListManager Members 38 39 public void Init(PeerInfo source, string contactServerUrl, int communicationRate) { 40 throw new System.NotImplementedException(); 41 } 42 43 #endregion 36 44 } 37 45 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageSender.cs
r13947 r13956 20 20 private Object timerLock = new Object(); 21 21 22 public void Init(PeerInfo source ) {22 public void Init(PeerInfo source, int messageCacheCapacity) { 23 23 myself = source; 24 24 bufferedMessages = new SizedConcurrentQueue<KeyValuePair<PeerInfo, byte[][]>>(); 25 bufferedMessages.Limit = 100000;25 bufferedMessages.Limit = messageCacheCapacity; 26 26 timer = new Timer(1000 * 60); //each 5 minutes 27 27 timer.Elapsed += GenerateSendingTasks; … … 72 72 } 73 73 } 74 74 75 } 75 76 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageService.cs
r13924 r13956 11 11 public event EventHandler<MessageRecieveEventArgs> OnDataRecieved; 12 12 13 private staticManualResetEvent _ResetEvent = new ManualResetEvent(false);13 private ManualResetEvent _ResetEvent = new ManualResetEvent(false); 14 14 15 15 private IMessageContract messageContract = null; -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
r13947 r13956 24 24 private IContactService heartbeatClient; 25 25 26 public void Init(PeerInfo source, string contactServerUrl) { 26 private int communicationRate; //how many peers are contacted by this peer in percent 27 28 public void Init(PeerInfo source, string contactServerUrl, int communicationRate) { 27 29 serverString = contactServerUrl; 30 this.communicationRate = communicationRate; 28 31 myself = source; 29 32 //Init ChannelFactory and Clients … … 69 72 private List<PeerInfo> ChoosePeersForMessaging(List<PeerInfo> allPeers) { 70 73 //communicate with 10% of the network 71 int noOfPeers = allPeers.Count / 10;74 int noOfPeers = allPeers.Count / (100 /communicationRate); 72 75 List<int> indexList = GetRandomItemIndexes(noOfPeers, 0, allPeers.Count - 1); 73 76 List<PeerInfo> res = new List<PeerInfo>();
Note: See TracChangeset
for help on using the changeset viewer.