Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13956 for branches/thasling


Ignore:
Timestamp:
06/29/16 15:28:47 (8 years ago)
Author:
thasling
Message:

#2615:
finally fixed bug concerning message send to the wrong peers
also made communicationRate and messageCacheCapacity as paramters
integration in P2PMigrationAnalyzer still TBD

Location:
branches/thasling/DistributedGA
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/thasling/DistributedGA/DistributedGA.Core

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3DistributedGA.Core.csproj.user
  • branches/thasling/DistributedGA/DistributedGA.Core.Host/Program.cs

    r13919 r13956  
    1515
    1616        IMessageHandler h = new PeerNetworkMessageHandler();
    17         h.Init(ipPrefix, serverUrl);
     17        h.Init(ipPrefix, serverUrl, "TestProblem", 10000, 100);
    1818
    1919        PeerInfo pi = h.GetPeerInfo();
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs

    r13947 r13956  
    2929
    3030
    31     public void Init(string lanIpPrefix, string contactServerUrl) {
     31    public void Init(string lanIpPrefix, string contactServerUrl, string problemInstance, int messageCacheCapacity, int communicationRate) {
    3232      try {
    3333        ownInstance = new PeerInfo() {
    3434          IpAddress = GetInternalIpAddress(lanIpPrefix),
    3535          Port = 0,
    36           ProblemInstance = "TestProblem"
     36          ProblemInstance = problemInstance
    3737        }; // TODO: get own peerinfo
    3838
    3939        writeQueue = new SizedConcurrentQueue<byte[]>();
    4040        readQueue = new SizedConcurrentQueue<byte[]>();
    41         writeQueue.Limit = 1000;
     41        writeQueue.Limit = messageCacheCapacity;
    4242        readQueue.Limit = writeQueue.Limit;
    4343
     
    4747
    4848        peerListManager = new WcfPeerListManager();
    49         peerListManager.Init(ownInstance, contactServerUrl);
     49        peerListManager.Init(ownInstance, contactServerUrl, communicationRate);
    5050
    5151        sender = new WcfMessageSender();
    52         sender.Init(ownInstance);
     52        sender.Init(ownInstance, messageCacheCapacity);
    5353
    5454      }
     
    141141          }
    142142        }
     143     
    143144      }
    144145    }
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/TestPeerListManager.cs

    r13918 r13956  
    3434           
    3535        }
     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
    3644    }
    3745}
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageSender.cs

    r13947 r13956  
    2020    private Object timerLock = new Object();
    2121
    22     public void Init(PeerInfo source) {
     22    public void Init(PeerInfo source, int messageCacheCapacity) {
    2323      myself = source;
    2424      bufferedMessages = new SizedConcurrentQueue<KeyValuePair<PeerInfo, byte[][]>>();
    25       bufferedMessages.Limit = 100000;
     25      bufferedMessages.Limit = messageCacheCapacity;
    2626      timer = new Timer(1000 * 60); //each 5 minutes
    2727      timer.Elapsed += GenerateSendingTasks;
     
    7272      }
    7373    }
     74
    7475  }
    7576}
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageService.cs

    r13924 r13956  
    1111    public event EventHandler<MessageRecieveEventArgs> OnDataRecieved;
    1212
    13     private static ManualResetEvent _ResetEvent = new ManualResetEvent(false);
     13    private ManualResetEvent _ResetEvent = new ManualResetEvent(false);
    1414
    1515    private IMessageContract messageContract = null;
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs

    r13947 r13956  
    2424    private IContactService heartbeatClient;
    2525
    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) {
    2729      serverString = contactServerUrl;
     30      this.communicationRate = communicationRate;
    2831      myself = source;
    2932      //Init ChannelFactory and Clients
     
    6972    private List<PeerInfo> ChoosePeersForMessaging(List<PeerInfo> allPeers) {
    7073      //communicate with 10% of the network
    71       int noOfPeers = allPeers.Count / 10;
     74      int noOfPeers = allPeers.Count / (100 /communicationRate);
    7275      List<int> indexList = GetRandomItemIndexes(noOfPeers, 0, allPeers.Count - 1);
    7376      List<PeerInfo> res = new List<PeerInfo>();
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IMessageHandler.cs

    r13924 r13956  
    66  public interface IMessageHandler {
    77
    8     void Init(string lanIpPrefix, string contactServerUrl); //Registers at contract-server
     8    void Init(string lanIpPrefix, string contactServerUrl, string problemInstance, int messageCacheCapacty, int communicationRate); //Registers at contract-server
    99
    1010    void PublishDataToNetwork(byte[][] data);
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IMessageSender.cs

    r13924 r13956  
    55  public interface IMessageSender {
    66
    7     void Init(PeerInfo source);
     7    void Init(PeerInfo source, int messageCacheCapacity);
    88
    99    void SendData(PeerInfo destination, byte[][] data);
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IPeerListManager.cs

    r13924 r13956  
    66  public interface IPeerListManager {
    77
    8     void Init(PeerInfo source, string contactServerUrl); //Registers own instance at the contact-server
     8    void Init(PeerInfo source, string contactServerUrl, int communicationRate); //Registers own instance at the contact-server
    99
    1010    List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server
  • branches/thasling/DistributedGA/DistributedGA.Hive/P2PMigrationAnalyzer.cs

    r13943 r13956  
    9999      var lanIpPrefix = ((StringValue)(Parameters["LanIpPrefix"].ActualValue)).Value;
    100100      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);
    102103      var peer = h.GetPeerInfo();
    103       peer.ProblemInstance = ((StringValue)Parameters["JobGUID"].ActualValue).Value;
    104104    }
    105105
  • branches/thasling/DistributedGA/DistributedGA.Hive/P2PTask.cs

    r13887 r13956  
    9999                    var lanIpPrefix = ((StringValue)(Parameters["LanIpPrefix"].ActualValue)).Value;
    100100                    var contactServerUri = ((StringValue)(Parameters["ContactServerURL"].ActualValue)).Value;
    101                     h.Init(lanIpPrefix, contactServerUri);
     101                    h.Init(lanIpPrefix, contactServerUri, "TEST", 10000, 100);
    102102                    PeerInfo pi = h.GetPeerInfo();
    103103                    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  
    2020    private void button2_Click(object sender, EventArgs e) {
    2121      IMessageSender c = new WcfMessageSender();
    22       c.Init(null);
     22      //c.Init(null);
    2323      c.SendData(null, null);
    2424    }
     
    2626    private void button3_Click(object sender, EventArgs e) {
    2727      IMessageHandler h1 = new PeerNetworkMessageHandler();
    28       h1.Init("", "");
     28      //h1.Init("", "", "");
    2929      IMessageHandler h2 = new PeerNetworkMessageHandler();
    30       h2.Init("", "");
     30      //h2.Init("", "");
    3131      IMessageHandler h3 = new PeerNetworkMessageHandler();
    32       h3.Init("", "");
     32      //h3.Init("", "");
    3333      IMessageHandler h4 = new PeerNetworkMessageHandler();
    34       h4.Init("", "");
     34      //h4.Init("", "");
    3535      IMessageHandler h5 = new PeerNetworkMessageHandler();
    36       h5.Init("", "");
     36      //h5.Init("", "");
    3737      //byte[] message = CreateTestMessage();
    3838      //h1.PublishDataToNetwork(pop1);
     
    5353    private void button4_Click(object sender, EventArgs e) {
    5454      var l = new WcfPeerListManager();
    55       l.Init(CreatePeerInfo(),"");
     55      //l.Init(CreatePeerInfo(),"");
    5656      l.GetPeerList();
    5757    }
Note: See TracChangeset for help on using the changeset viewer.