Don't generate a zero-length packet in case of errors.
The packet converter used to generate packets of length zero when it encountered errors during conversion. This caused exceptions in packet analyzers. Now the converter returns null in case of error. Appropriate checks have been added to the code that uses the return value.
This commit is contained in:
parent
eae25d622d
commit
034a97eed2
4 changed files with 13 additions and 7 deletions
|
@ -76,7 +76,8 @@ public abstract class AbstractApplicationMote extends AbstractWakeupMote impleme
|
|||
if (radio.getLastPacketReceived() != null)
|
||||
receivedPacket(radio.getLastPacketReceived());
|
||||
} else if (radio.getLastEvent() == Radio.RadioEvent.TRANSMISSION_FINISHED) {
|
||||
sentPacket(radio.getLastPacketTransmitted());
|
||||
if (radio.getLastPacketTransmitted() != null)
|
||||
sentPacket(radio.getLastPacketTransmitted());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -517,10 +517,12 @@ public class RadioLogger extends VisPlugin {
|
|||
return;
|
||||
}
|
||||
final RadioConnectionLog loggedConn = new RadioConnectionLog();
|
||||
loggedConn.packet = conn.getSource().getLastPacketTransmitted();
|
||||
if (loggedConn.packet == null)
|
||||
return;
|
||||
loggedConn.startTime = conn.getStartTime();
|
||||
loggedConn.endTime = simulation.getSimulationTime();
|
||||
loggedConn.connection = conn;
|
||||
loggedConn.packet = conn.getSource().getLastPacketTransmitted();
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue