Skip to content
Snippets Groups Projects
Commit 116e1941 authored by akwizgran's avatar akwizgran
Browse files

Replace the modem instance if an exception occurs.

parent 14f2fd19
No related branches found
No related tags found
No related merge requests found
......@@ -88,14 +88,17 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
// Synchronized to avoid a race condition with stop()
private synchronized boolean resetModem() {
if(!running) return false;
try {
modem.init();
return true;
} catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
running = false;
return false;
for(String portName : SerialPortList.getPortNames()) {
modem = modemFactory.createModem(this, portName);
try {
modem.init();
return true;
} catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
}
}
running = false;
return false;
}
public boolean shouldPoll() {
......
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