Changeset 13937
- Timestamp:
- 06/24/16 21:23:47 (8 years ago)
- Location:
- branches/thasling/DistributedGA
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.Core/DistributedGA.Core.csproj
r13887 r13937 64 64 <Compile Include="Interface\IPeerListManager.cs" /> 65 65 <Compile Include="Properties\AssemblyInfo.cs" /> 66 <Compile Include="Util\SizedConcurrentQueue.cs" /> 66 67 </ItemGroup> 67 68 <ItemGroup> -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs
r13924 r13937 6 6 using DistributedGA.Core.Domain; 7 7 using DistributedGA.Core.Interface; 8 using DistributedGA.Core.Util; 8 9 9 10 namespace DistributedGA.Core.Implementation { … … 21 22 //to queues are used to gather and and provide population more efficiently 22 23 private object activeQueueLocker = new object(); 23 private ConcurrentQueue<byte[]> writeQueue;24 private ConcurrentQueue<byte[]> readQueue;24 private SizedConcurrentQueue<byte[]> writeQueue; 25 private SizedConcurrentQueue<byte[]> readQueue; 25 26 26 27 //uses IMessageService for recieving population from one peer at once … … 37 38 }; // TODO: get own peerinfo 38 39 39 writeQueue = new ConcurrentQueue<byte[]>(); 40 readQueue = new ConcurrentQueue<byte[]>(); 41 40 writeQueue = new SizedConcurrentQueue<byte[]>(); 41 readQueue = new SizedConcurrentQueue<byte[]>(); 42 writeQueue.Limit = 1000; 43 readQueue.Limit = writeQueue.Limit; 42 44 43 45 host = new WcfMessageService(); 44 46 ownInstance.Port = host.Init(ownInstance.IpAddress); //getting port, on which service is hostet 45 host.OnDataRecieved += new EventHandler<MessageRecieveEventArgs>(On PopulationRecieved);47 host.OnDataRecieved += new EventHandler<MessageRecieveEventArgs>(OnDataRecieved); 46 48 47 49 peerListManager = new WcfPeerListManager(); … … 131 133 } 132 134 133 private void On PopulationRecieved(object sender, MessageRecieveEventArgs e) {135 private void OnDataRecieved(object sender, MessageRecieveEventArgs e) { 134 136 if (e != null) { 135 137 lock (activeQueueLocker) { -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageSender.cs
r13923 r13937 7 7 using DistributedGA.Core.Domain; 8 8 using DistributedGA.Core.Interface; 9 using DistributedGA.Core.Util; 9 10 10 11 namespace DistributedGA.Core.Implementation { … … 13 14 private PeerInfo myself; 14 15 15 private ConcurrentQueue<KeyValuePair<PeerInfo, byte[][]>> bufferedMessages;16 private SizedConcurrentQueue<KeyValuePair<PeerInfo, byte[][]>> bufferedMessages; 16 17 17 18 private Timer timer; //sends cached messages to network in background … … 19 20 public void Init(PeerInfo source) { 20 21 myself = source; 21 bufferedMessages = new ConcurrentQueue<KeyValuePair<PeerInfo, byte[][]>>(); 22 bufferedMessages = new SizedConcurrentQueue<KeyValuePair<PeerInfo, byte[][]>>(); 23 bufferedMessages.Limit = 1000; 22 24 timer = new Timer(1000 * 60); //each 5 minutes 23 25 timer.Elapsed += GenerateSendingTasks; -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
r13923 r13937 60 60 ((IClientChannel)heartbeatClient).Close(); 61 61 myChannelFactory.Close(); 62 client = null; 63 myChannelFactory = null; 62 64 } 63 65
Note: See TracChangeset
for help on using the changeset viewer.