Skip to content
Snippets Groups Projects
Commit a644ab68 authored by terry-norbraten's avatar terry-norbraten
Browse files

remove the added listener

parent 52e7f3a5
No related branches found
No related tags found
No related merge requests found
......@@ -48,25 +48,10 @@ public class PduRecorder implements PduReceiver
private static String pduLogEncoding = ENCODING_PLAINTEXT; // TODO use Java enumerations, generalize/share across library
/**
* TODO change this to enumeration type for strictness
* @return the pduLogEncoding
*/
public static String getEncoding() {
return pduLogEncoding;
}
/**
* @param aEncoding the pduLogEncoding to set
*/
public static void setEncoding(String aEncoding) {
pduLogEncoding = aEncoding;
}
private Writer writer;
private File logFile;
private DisThreadedNetIF disThreadedNetIF;
private DisThreadedNetIF.RawPduListener lis;
/**
* Default constructor that uses default values for output directory, multicast
......@@ -106,12 +91,34 @@ public class PduRecorder implements PduReceiver
writer = new PrintWriter(new BufferedWriter(new FileWriter(logFile)));
disThreadedNetIF = new DisThreadedNetIF(port, mcastaddr);
disThreadedNetIF.addRawListener(bAndL -> {
receivePdu(bAndL.buff, bAndL.length);
});
lis = new DisThreadedNetIF.RawPduListener() {
@Override
public void incomingPdu(DisThreadedNetIF.BuffAndLength bAndL) {
receivePdu(bAndL.buff, bAndL.length);
}
};
disThreadedNetIF.addRawListener(lis);
System.out.println(getClass() + " listening to IP address " + mcastaddr + " on port: " + port);
}
/**
* TODO change this to enumeration type for strictness
*
* @return the pduLogEncoding
*/
public static String getEncoding() {
return pduLogEncoding;
}
/**
* @param aEncoding the pduLogEncoding to set
*/
public static void setEncoding(String aEncoding) {
pduLogEncoding = aEncoding;
}
public void startResume()
{
doSave = true;
......@@ -124,6 +131,8 @@ public class PduRecorder implements PduReceiver
public File end()
{
doSave = false;
disThreadedNetIF.removeRawListener(lis);
disThreadedNetIF.kill();
writeFooter();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment