Changeset 14261
- Timestamp:
- 08/20/16 10:45:48 (8 years ago)
- Location:
- branches/thasling/DistributedGA
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.ContactServer/ContactServiceImpl.cs
r14252 r14261 56 56 } 57 57 58 public void MakeLog(PeerInfo source, string msg) {59 try {60 // TODO61 lock (logLock) {62 File.AppendAllText("Log.txt", string.Concat(source.IpAddress, ":", source.Port, ",", source.ProblemInstance, ",", msg, Environment.NewLine));63 }64 }65 catch {66 //Nothing to do because maybe called from adderror67 }68 }69 70 58 public void UpdateHeartbeat(PeerInfo source) { 71 59 try { … … 102 90 103 91 private void AddError(string source, Exception ex) { 104 MakeLog(new PeerInfo() { ProblemInstance = "ContactServer Error at " + source }, ex.Message); 92 105 93 } 106 94 -
branches/thasling/DistributedGA/DistributedGA.ContactServer/IContactService.cs
r13924 r14261 18 18 [OperationContract] 19 19 void UpdateHeartbeat(PeerInfo source); //Sends heartbeat to contact-server 20 21 [OperationContract]22 void MakeLog(PeerInfo source, string msg); //Used to log all peers at a single location23 24 20 } 25 21 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs
r14253 r14261 53 53 sender.Init(ownInstance, messageCacheCapacity); 54 54 55 } catch (Exception ex) { 55 } 56 catch (Exception ex) { 56 57 AddError("PeerNetworkMessageHandler.Init", ex); 57 58 } … … 63 64 sender.Dispose(); 64 65 peerListManager.Dispose(); 65 } catch (Exception ex) { 66 } 67 catch (Exception ex) { 66 68 AddError("PeerNetworkMessageHandler.Dispose", ex); 67 69 } … … 74 76 try { 75 77 sender.SendData(peer, data); 76 } catch (Exception ex) { 78 } 79 catch (Exception ex) { 77 80 AddError("PeerNetworkMessageHandler.PublishDataToNetwork(during sending to one peer!)", ex); 78 81 } 79 82 } 80 83 81 } catch (Exception ex) { 84 } 85 catch (Exception ex) { 82 86 AddError("PeerNetworkMessageHandler.PublishDataToNetwork", ex); 83 87 } … … 103 107 } 104 108 return res;//.ToArray(); 105 } catch (Exception ex) { 109 } 110 catch (Exception ex) { 106 111 AddError("PeerNetworkMessageHandler.GetDataFromNetwork", ex); 107 112 return null; … … 133 138 .Select(ip => ip.ToString()) 134 139 .First(str => str.StartsWith(ipPrefix)); 135 } catch { return null; } 140 } 141 catch { return null; } 136 142 } 137 143 … … 147 153 private void AddError(string source, Exception ex) { 148 154 PropagateException(ex); 149 if (peerListManager != null) {150 try {151 peerListManager.SendLogToServer(string.Concat("Source: ", source, ", Exception: ", ex.Message));152 } catch { }153 }154 155 } 156 155 157 } 156 158 } -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageSender.cs
r14253 r14261 76 76 77 77 Task.WaitAll(runningTasks.ToArray()); 78 } finally { 78 } 79 finally { 79 80 isActive = false; 80 81 } … … 129 130 } 130 131 } 131 } catch (Exception ex) { 132 } 133 catch (Exception ex) { 132 134 //ignore 133 135 Console.WriteLine(ex.Message); -
branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs
r14253 r14261 41 41 public List<PeerInfo> GetPeerList() { 42 42 return cachedPeerList; 43 }44 45 public void SendLogToServer(string msg) {46 var binding = new NetTcpBinding();47 var endpoint = new EndpointAddress(serverString);48 using (var myChannelFactory = new ChannelFactory<IContactService>(binding, endpoint)) {49 using (IClientChannel client = (IClientChannel)myChannelFactory.CreateChannel()) {50 ((IContactService)client).MakeLog(myself, msg);51 }52 }53 43 } 54 44 -
branches/thasling/DistributedGA/DistributedGA.Core/Interface/IContactService.cs
r13924 r14261 18 18 [OperationContract] 19 19 void UpdateHeartbeat(PeerInfo source); //Sends heartbeat to contact-server 20 21 [OperationContract]22 void MakeLog(PeerInfo source, string msg); //Used to log all peers at a single location23 24 20 } 25 21 } -
branches/thasling/DistributedGA/DistributedGA.Core/Interface/IPeerListManager.cs
r14009 r14261 10 10 List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server 11 11 12 void SendLogToServer(string msg);13 14 12 void Dispose(); 15 13 } -
branches/thasling/DistributedGA/DistributedGA.Hive/P2PMigrationAnalyzer.cs
r14254 r14261 284 284 scope.SubScopes.Insert(insertPos, immigrantScope); 285 285 286 //var log = LogParameter.Value;287 //double quality = qImmigrant;288 //log.LogMessage(string.Format("Recieved individual with quality {0} from peer {1}:{2} ; Job: {3}",289 //quality, msg.Key.IpAddress, msg.Key.Port, msg.Key.ProblemInstance));286 var log = LogParameter.Value; 287 double quality = qImmigrant; 288 log.LogMessage(string.Format("Recieved individual with quality {0} from peer {1}:{2} ; Job: {3}", 289 quality, msg.Key.IpAddress, msg.Key.Port, msg.Key.ProblemInstance)); 290 290 } 291 291 } -
branches/thasling/DistributedGA/DistributedGA.sln
r14253 r14261 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 12.00 3 # Visual Studio 2012 3 # Visual Studio 2013 4 VisualStudioVersion = 12.0.21005.1 5 MinimumVisualStudioVersion = 10.0.40219.1 4 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistributedGA.Test", "DistributedGA.Test\DistributedGA.Test.csproj", "{E0E91C06-C56A-454F-9F7C-3FA7AE7F920E}" 5 7 EndProject … … 48 50 HideSolutionNode = FALSE 49 51 EndGlobalSection 52 GlobalSection(Performance) = preSolution 53 HasPerformanceSessions = true 54 EndGlobalSection 50 55 EndGlobal
Note: See TracChangeset
for help on using the changeset viewer.