Skip to content

Commit

Permalink
mqtt bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas committed Sep 4, 2018
1 parent 0886894 commit 517e6e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ species NetworkingAgent skills:[network]{
reflex send3 when: cycle mod 10 = 8
{
write "sending message: " + self;
do send to:"send" contents:self;
do send to:"sender" contents:self;
do send to:"receive" contents:self;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ public void marshal(final Object arg0, final HierarchicalStreamWriter writer, fi
writer.endNode();

final Map<String, List<SavedAgent>> inPop = savedAgt.getInnerPopulations();
writer.startNode("innerPopulations");
context.convertAnother(inPop);
writer.endNode();
if(inPop!=null)
{
writer.startNode("innerPopulations");
context.convertAnother(inPop);
writer.endNode();
}
}

@Override
Expand All @@ -91,11 +94,14 @@ public Object unmarshal(final HierarchicalStreamReader reader, final Unmarshalli
for (int ii = 0; ii < keys.size(); ii++) {
localData.put(keys.get(ii), datas.get(ii));
}

reader.moveDown();
Map<String, List<SavedAgent>> inPop = null;
inPop = (Map<String, List<SavedAgent>>) arg1.convertAnother(null, THashMap.class);
reader.moveUp();

if(reader.hasMoreChildren())
{
reader.moveDown();
inPop = (Map<String, List<SavedAgent>>) arg1.convertAnother(null, THashMap.class);
reader.moveUp();
}

final SavedAgent agtToReturn = new SavedAgent(index, localData, inPop);

Expand Down

0 comments on commit 517e6e2

Please sign in to comment.