Changeset 1207
- Timestamp:
- 02/05/09 11:24:25 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Communication.Operators
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Communication.Operators/CommunicatorBase.cs
r704 r1207 28 28 Message message = GetVariableValue<Message>("Message", scope, false, false); 29 29 30 if (message == null) { // RECEIVE MODE (no message present or not from this source)30 if (message == null) { // RECEIVE MODE (no message present) 31 31 message = Receive(scope, protocol, currentState); 32 if (message == null) throw new InvalidOperationException("ERROR in Communicator: Message could not be received"); 32 33 if (!info.Local) scope.AddVariable(new Variable(actualName, message)); 33 34 else AddVariable(new Variable(actualName, message)); -
trunk/sources/HeuristicLab.Communication.Operators/DataStreamCommunicator.cs
r704 r1207 43 43 private string Encode(Message message) { 44 44 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; 46 46 } 47 47 … … 57 57 IDataStream connection = scope.GetVariableValue<IDataStream>("DataStream", true); 58 58 connection.Write("PROTOCOL_ID " + protocol.Name); 59 if (connection.Read().Equals("ACK")) { 59 string s = connection.Read(); 60 if (s.Trim().Equals("ACK")) { 60 61 connection.Write("STATE_ID " + currentState.Name); 61 if (connection.Read().Equals("ACK")) { 62 s = connection.Read(); 63 if (s.Trim().Equals("ACK")) { 62 64 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); 65 67 } 66 68 … … 70 72 string rcvd = connection.Read(); 71 73 if (rcvd.StartsWith("PROTOCOL_ID ")) { 72 if (rcvd.Substring(12). Equals(protocol.Name)) {74 if (rcvd.Substring(12).Trim().Equals(protocol.Name)) { 73 75 connection.Write("ACK"); 74 76 rcvd = connection.Read(); 75 77 if (rcvd.StartsWith("STATE_ID ")) { 76 if (rcvd.Substring(9). Equals(currentState.Name)) {78 if (rcvd.Substring(9).Trim().Equals(currentState.Name)) { 77 79 connection.Write("ACK"); 78 80 message = Decode(connection.Read()); -
trunk/sources/HeuristicLab.Communication.Operators/LocalProcessInitiator.cs
r591 r1207 42 42 ProcessData proc = new ProcessData(); 43 43 proc.Initialize(config); 44 proc.Connect(); 44 45 45 46 IVariableInfo info = GetVariableInfo("Process"); -
trunk/sources/HeuristicLab.Communication.Operators/MessageProcessor.cs
r704 r1207 61 61 message.Source = peerName; 62 62 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 } 63 70 } 64 71 } -
trunk/sources/HeuristicLab.Communication.Operators/SubScopeMessageDecomposer.cs
r704 r1207 22 22 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"); 23 23 int i = 0; 24 foreach (IVariable var in message. Expect) {24 foreach (IVariable var in message.Give) { 25 25 scope.SubScopes[i].AddVariable(var); 26 26 }
Note: See TracChangeset
for help on using the changeset viewer.