Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14261


Ignore:
Timestamp:
08/20/16 10:45:48 (8 years ago)
Author:
thasling
Message:

#2615:
re-enabled log in P2PMigrationAnalyzer
made code formatings

Location:
branches/thasling/DistributedGA
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/thasling/DistributedGA/DistributedGA.ContactServer/ContactServiceImpl.cs

    r14252 r14261  
    5656    }
    5757
    58     public void MakeLog(PeerInfo source, string msg) {
    59       try {
    60         // TODO
    61         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 adderror
    67       }
    68     }
    69 
    7058    public void UpdateHeartbeat(PeerInfo source) {
    7159      try {
     
    10290
    10391    private void AddError(string source, Exception ex) {
    104       MakeLog(new PeerInfo() { ProblemInstance = "ContactServer  Error at " + source }, ex.Message);
     92
    10593    }
    10694
  • branches/thasling/DistributedGA/DistributedGA.ContactServer/IContactService.cs

    r13924 r14261  
    1818    [OperationContract]
    1919    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 location
    23 
    2420  }
    2521}
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/PeerNetworkMessageHandler.cs

    r14253 r14261  
    5353        sender.Init(ownInstance, messageCacheCapacity);
    5454
    55       } catch (Exception ex) {
     55      }
     56      catch (Exception ex) {
    5657        AddError("PeerNetworkMessageHandler.Init", ex);
    5758      }
     
    6364        sender.Dispose();
    6465        peerListManager.Dispose();
    65       } catch (Exception ex) {
     66      }
     67      catch (Exception ex) {
    6668        AddError("PeerNetworkMessageHandler.Dispose", ex);
    6769      }
     
    7476          try {
    7577            sender.SendData(peer, data);
    76           } catch (Exception ex) {
     78          }
     79          catch (Exception ex) {
    7780            AddError("PeerNetworkMessageHandler.PublishDataToNetwork(during sending to one peer!)", ex);
    7881          }
    7982        }
    8083
    81       } catch (Exception ex) {
     84      }
     85      catch (Exception ex) {
    8286        AddError("PeerNetworkMessageHandler.PublishDataToNetwork", ex);
    8387      }
     
    103107        }
    104108        return res;//.ToArray();
    105       } catch (Exception ex) {
     109      }
     110      catch (Exception ex) {
    106111        AddError("PeerNetworkMessageHandler.GetDataFromNetwork", ex);
    107112        return null;
     
    133138          .Select(ip => ip.ToString())
    134139          .First(str => str.StartsWith(ipPrefix));
    135       } catch { return null; }
     140      }
     141      catch { return null; }
    136142    }
    137143
     
    147153    private void AddError(string source, Exception ex) {
    148154      PropagateException(ex);
    149       if (peerListManager != null) {
    150         try {
    151           peerListManager.SendLogToServer(string.Concat("Source: ", source, ", Exception: ", ex.Message));
    152         } catch { }
    153       }
    154155    }
     156
    155157  }
    156158}
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfMessageSender.cs

    r14253 r14261  
    7676
    7777          Task.WaitAll(runningTasks.ToArray());
    78         } finally {
     78        }
     79        finally {
    7980          isActive = false;
    8081        }
     
    129130          }
    130131        }
    131       } catch (Exception ex) {
     132      }
     133      catch (Exception ex) {
    132134        //ignore
    133135        Console.WriteLine(ex.Message);
  • branches/thasling/DistributedGA/DistributedGA.Core/Implementation/WcfPeerListManager.cs

    r14253 r14261  
    4141    public List<PeerInfo> GetPeerList() {
    4242      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       }
    5343    }
    5444
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IContactService.cs

    r13924 r14261  
    1818    [OperationContract]
    1919    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 location
    23 
    2420  }
    2521}
  • branches/thasling/DistributedGA/DistributedGA.Core/Interface/IPeerListManager.cs

    r14009 r14261  
    1010    List<PeerInfo> GetPeerList(); //Recieves all peers in the network from contact-server
    1111
    12     void SendLogToServer(string msg);
    13 
    1412    void Dispose();
    1513  }
  • branches/thasling/DistributedGA/DistributedGA.Hive/P2PMigrationAnalyzer.cs

    r14254 r14261  
    284284              scope.SubScopes.Insert(insertPos, immigrantScope);
    285285
    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));
    290290            }
    291291          }
  • branches/thasling/DistributedGA/DistributedGA.sln

    r14253 r14261  
    11
    22Microsoft Visual Studio Solution File, Format Version 12.00
    3 # Visual Studio 2012
     3# Visual Studio 2013
     4VisualStudioVersion = 12.0.21005.1
     5MinimumVisualStudioVersion = 10.0.40219.1
    46Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DistributedGA.Test", "DistributedGA.Test\DistributedGA.Test.csproj", "{E0E91C06-C56A-454F-9F7C-3FA7AE7F920E}"
    57EndProject
     
    4850    HideSolutionNode = FALSE
    4951  EndGlobalSection
     52  GlobalSection(Performance) = preSolution
     53    HasPerformanceSessions = true
     54  EndGlobalSection
    5055EndGlobal
Note: See TracChangeset for help on using the changeset viewer.