More logging to debug the reliability layer.

This commit is contained in:
akwizgran
2012-12-06 15:45:14 +00:00
parent 78953289f7
commit e9ebec44cd
2 changed files with 8 additions and 1 deletions

View File

@@ -167,6 +167,11 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
} else if(ev.isDSR() && ev.getEventValue() == 0) { } else if(ev.isDSR() && ev.getEventValue() == 0) {
if(LOG.isLoggable(INFO)) LOG.info("Remote end hung up"); if(LOG.isLoggable(INFO)) LOG.info("Remote end hung up");
hangUp(); hangUp();
} else {
if(LOG.isLoggable(INFO)) {
LOG.info("Serial event " + ev.getEventType() + " " +
ev.getEventValue());
}
} }
} catch(IOException e) { } catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);

View File

@@ -43,6 +43,8 @@ class ReliabilityLayer implements ReadHandler, WriteHandler {
while(valid) { while(valid) {
byte[] b = writes.take(); byte[] b = writes.take();
if(b.length == 0) return; // Poison pill if(b.length == 0) return; // Poison pill
if(LOG.isLoggable(INFO))
LOG.info("Writing " + b.length + " bytes");
writeHandler.handleWrite(b); writeHandler.handleWrite(b);
} }
} catch(InterruptedException e) { } catch(InterruptedException e) {
@@ -83,7 +85,7 @@ class ReliabilityLayer implements ReadHandler, WriteHandler {
// The SLIP encoder calls this method to pass data down to the modem // The SLIP encoder calls this method to pass data down to the modem
public void handleWrite(byte[] b) throws IOException { public void handleWrite(byte[] b) throws IOException {
if(!valid) throw new IOException("Connection closed"); if(!valid) throw new IOException("Connection closed");
if(LOG.isLoggable(INFO)) LOG.info("Writing " + b.length + " bytes"); if(LOG.isLoggable(INFO)) LOG.info("Queueing " + b.length + " bytes");
if(b.length > 0) writes.add(b); if(b.length > 0) writes.add(b);
} }
} }