mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 22:59:54 +01:00
Don't let references to this escape from constructors.
This commit is contained in:
@@ -38,7 +38,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
|||||||
|
|
||||||
private int lineLen = 0;
|
private int lineLen = 0;
|
||||||
|
|
||||||
private volatile ReliabilityLayer reliabilityLayer;
|
private volatile ReliabilityLayer reliabilityLayer = null;
|
||||||
|
|
||||||
ModemImpl(Executor executor, Callback callback, String portName) {
|
ModemImpl(Executor executor, Callback callback, String portName) {
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
@@ -48,7 +48,6 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
|||||||
offHook = new Semaphore(1);
|
offHook = new Semaphore(1);
|
||||||
connected = new AtomicBoolean(false);
|
connected = new AtomicBoolean(false);
|
||||||
line = new byte[MAX_LINE_LENGTH];
|
line = new byte[MAX_LINE_LENGTH];
|
||||||
reliabilityLayer = new ReliabilityLayer(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
@@ -106,6 +105,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
|||||||
LOG.info("Not dialling - call in progress");
|
LOG.info("Not dialling - call in progress");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
reliabilityLayer = new ReliabilityLayer(this);
|
||||||
reliabilityLayer.start();
|
reliabilityLayer.start();
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Dialling");
|
if(LOG.isLoggable(INFO)) LOG.info("Dialling");
|
||||||
try {
|
try {
|
||||||
@@ -145,7 +145,6 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
|||||||
throw new IOException(e.toString());
|
throw new IOException(e.toString());
|
||||||
}
|
}
|
||||||
reliabilityLayer.stop();
|
reliabilityLayer.stop();
|
||||||
reliabilityLayer = new ReliabilityLayer(this);
|
|
||||||
connected.set(false);
|
connected.set(false);
|
||||||
offHook.release();
|
offHook.release();
|
||||||
}
|
}
|
||||||
@@ -239,6 +238,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
|||||||
LOG.info("Not answering - call in progress");
|
LOG.info("Not answering - call in progress");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
reliabilityLayer = new ReliabilityLayer(this);
|
||||||
reliabilityLayer.start();
|
reliabilityLayer.start();
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Answering");
|
if(LOG.isLoggable(INFO)) LOG.info("Answering");
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user