mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 23:29:52 +01:00
Replace the modem instance if an exception occurs.
This commit is contained in:
@@ -88,14 +88,17 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
// Synchronized to avoid a race condition with stop()
|
// Synchronized to avoid a race condition with stop()
|
||||||
private synchronized boolean resetModem() {
|
private synchronized boolean resetModem() {
|
||||||
if(!running) return false;
|
if(!running) return false;
|
||||||
try {
|
for(String portName : SerialPortList.getPortNames()) {
|
||||||
modem.init();
|
modem = modemFactory.createModem(this, portName);
|
||||||
return true;
|
try {
|
||||||
} catch(IOException e) {
|
modem.init();
|
||||||
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
|
return true;
|
||||||
running = false;
|
} catch(IOException e) {
|
||||||
return false;
|
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
running = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldPoll() {
|
public boolean shouldPoll() {
|
||||||
|
|||||||
Reference in New Issue
Block a user