Changeset 13956
- Timestamp:
- 06/29/16 15:28:47 (8 years ago)
- Location:
- branches/thasling/DistributedGA
- Files:
-
- 13 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.Host/Program.cs
r13919 r13956 15 15 16 16 IMessageHandler h = new PeerNetworkMessageHandler(); 17 h.Init(ipPrefix, serverUrl );17 h.Init(ipPrefix, serverUrl, "TestProblem", 10000, 100); 18 18 19 19 PeerInfo pi = h.GetPeerInfo(); -
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>(); -
branches/thasling/DistributedGA/DistributedGA.Core/Interface/IMessageHandler.cs
r13924 r13956 6 6 public interface IMessageHandler { 7 7 8 void Init(string lanIpPrefix, string contactServerUrl ); //Registers at contract-server8 void Init(string lanIpPrefix, string contactServerUrl, string problemInstance, int messageCacheCapacty, int communicationRate); //Registers at contract-server 9 9 10 10 void PublishDataToNetwork(byte[][] data); -
branches/thasling/DistributedGA/DistributedGA.Core/Interface/IMessageSender.cs
r13924 r13956 5 5 public interface IMessageSender { 6 6 7 void Init(PeerInfo source );7 void Init(PeerInfo source, int messageCacheCapacity); 8 8 9 9 void SendData(PeerInfo destination, byte[][] data); -
branches/thasling/DistributedGA/DistributedGA.Core/Interface/IPeerListManager.cs
r13924 r13956 6 6 public interface IPeerListManager { 7 7 8 void Init(PeerInfo source, string contactServerUrl ); //Registers own instance at the contact-server8 void Init(PeerInfo source, string contactServerUrl, int communicationRate); //Registers own instance at the contact-server 9 9 10 10 List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server -
branches/thasling/DistributedGA/DistributedGA.Hive/P2PMigrationAnalyzer.cs
r13943 r13956 99 99 var lanIpPrefix = ((StringValue)(Parameters["LanIpPrefix"].ActualValue)).Value; 100 100 var contactServerUri = ((StringValue)(Parameters["ContactServerURL"].ActualValue)).Value; 101 h.Init(lanIpPrefix, contactServerUri); 101 var problemInstance = ((StringValue)Parameters["JobGUID"].ActualValue).Value; 102 h.Init(lanIpPrefix, contactServerUri, problemInstance, 10000, 100); 102 103 var peer = h.GetPeerInfo(); 103 peer.ProblemInstance = ((StringValue)Parameters["JobGUID"].ActualValue).Value;104 104 } 105 105 -
branches/thasling/DistributedGA/DistributedGA.Hive/P2PTask.cs
r13887 r13956 99 99 var lanIpPrefix = ((StringValue)(Parameters["LanIpPrefix"].ActualValue)).Value; 100 100 var contactServerUri = ((StringValue)(Parameters["ContactServerURL"].ActualValue)).Value; 101 h.Init(lanIpPrefix, contactServerUri );101 h.Init(lanIpPrefix, contactServerUri, "TEST", 10000, 100); 102 102 PeerInfo pi = h.GetPeerInfo(); 103 103 log.LogMessage(string.Format("Peer is hostet at IP: {0} and port: {1}", pi.IpAddress, pi.Port)); -
branches/thasling/DistributedGA/DistributedGA.Test/Form1.cs
r13887 r13956 20 20 private void button2_Click(object sender, EventArgs e) { 21 21 IMessageSender c = new WcfMessageSender(); 22 c.Init(null);22 //c.Init(null); 23 23 c.SendData(null, null); 24 24 } … … 26 26 private void button3_Click(object sender, EventArgs e) { 27 27 IMessageHandler h1 = new PeerNetworkMessageHandler(); 28 h1.Init("", "");28 //h1.Init("", "", ""); 29 29 IMessageHandler h2 = new PeerNetworkMessageHandler(); 30 h2.Init("", "");30 //h2.Init("", ""); 31 31 IMessageHandler h3 = new PeerNetworkMessageHandler(); 32 h3.Init("", "");32 //h3.Init("", ""); 33 33 IMessageHandler h4 = new PeerNetworkMessageHandler(); 34 h4.Init("", "");34 //h4.Init("", ""); 35 35 IMessageHandler h5 = new PeerNetworkMessageHandler(); 36 h5.Init("", "");36 //h5.Init("", ""); 37 37 //byte[] message = CreateTestMessage(); 38 38 //h1.PublishDataToNetwork(pop1); … … 53 53 private void button4_Click(object sender, EventArgs e) { 54 54 var l = new WcfPeerListManager(); 55 l.Init(CreatePeerInfo(),"");55 //l.Init(CreatePeerInfo(),""); 56 56 l.GetPeerList(); 57 57 }
Note: See TracChangeset
for help on using the changeset viewer.