Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/05/09 11:24:25 (16 years ago)
Author:
abeham
Message:

fixed some bugs (#486)

Location:
trunk/sources/HeuristicLab.Communication.Operators
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Communication.Operators/CommunicatorBase.cs

    r704 r1207  
    2828      Message message = GetVariableValue<Message>("Message", scope, false, false);
    2929
    30       if (message == null) { // RECEIVE MODE (no message present or not from this source)
     30      if (message == null) { // RECEIVE MODE (no message present)
    3131        message = Receive(scope, protocol, currentState);
     32        if (message == null) throw new InvalidOperationException("ERROR in Communicator: Message could not be received");
    3233        if (!info.Local) scope.AddVariable(new Variable(actualName, message));
    3334        else AddVariable(new Variable(actualName, message));
  • trunk/sources/HeuristicLab.Communication.Operators/DataStreamCommunicator.cs

    r704 r1207  
    4343    private string Encode(Message message) {
    4444      XmlDocument document = new XmlDocument();
    45       return message.GetXmlNode("Message", document, new Dictionary<Guid, IStorable>()).ToString();
     45      return message.GetXmlNode("Message", document, new Dictionary<Guid, IStorable>()).OuterXml;
    4646    }
    4747
     
    5757      IDataStream connection = scope.GetVariableValue<IDataStream>("DataStream", true);
    5858      connection.Write("PROTOCOL_ID " + protocol.Name);
    59       if (connection.Read().Equals("ACK")) {
     59      string s = connection.Read();
     60      if (s.Trim().Equals("ACK")) {
    6061        connection.Write("STATE_ID " + currentState.Name);
    61         if (connection.Read().Equals("ACK")) {
     62        s = connection.Read();
     63        if (s.Trim().Equals("ACK")) {
    6264          connection.Write(Encode(message));
    63         }
    64       }
     65        } else throw new InvalidOperationException("Received unexpected response [2]: " + s);
     66      } else throw new InvalidOperationException("Received unexpected response [1]: " + s);
    6567    }
    6668
     
    7072      string rcvd = connection.Read();
    7173      if (rcvd.StartsWith("PROTOCOL_ID ")) {
    72         if (rcvd.Substring(12).Equals(protocol.Name)) {
     74        if (rcvd.Substring(12).Trim().Equals(protocol.Name)) {
    7375          connection.Write("ACK");
    7476          rcvd = connection.Read();
    7577          if (rcvd.StartsWith("STATE_ID ")) {
    76             if (rcvd.Substring(9).Equals(currentState.Name)) {
     78            if (rcvd.Substring(9).Trim().Equals(currentState.Name)) {
    7779              connection.Write("ACK");
    7880              message = Decode(connection.Read());
  • trunk/sources/HeuristicLab.Communication.Operators/LocalProcessInitiator.cs

    r591 r1207  
    4242      ProcessData proc = new ProcessData();
    4343      proc.Initialize(config);
     44      proc.Connect();
    4445
    4546      IVariableInfo info = GetVariableInfo("Process");
  • trunk/sources/HeuristicLab.Communication.Operators/MessageProcessor.cs

    r704 r1207  
    6161              message.Source = peerName;
    6262              message.Timestamp = DateTime.Now;
     63            } else { // otherwise delete the message
     64              IVariableInfo messageInfo = GetVariableInfo("Message");
     65              if (messageInfo.Local) {
     66                RemoveVariable(messageInfo.ActualName);
     67              } else {
     68                scope.RemoveVariable(scope.TranslateName(messageInfo.ActualName));
     69              }
    6370            }
    6471          }
  • trunk/sources/HeuristicLab.Communication.Operators/SubScopeMessageDecomposer.cs

    r704 r1207  
    2222      if (message.Expect.Count > scope.SubScopes.Count) throw new InvalidOperationException("ERROR in SubScopeMessageDecomposer: There are not enough subscopes to put the contents of the message into");
    2323      int i = 0;
    24       foreach (IVariable var in message.Expect) {
     24      foreach (IVariable var in message.Give) {
    2525        scope.SubScopes[i].AddVariable(var);
    2626      }
Note: See TracChangeset for help on using the changeset viewer.