Free cookie consent management tool by TermsFeed Policy Generator

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/DistributedGA.Core
Files:
9 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/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
Note: See TracChangeset for help on using the changeset viewer.