# HG changeset patch # User Carl Byington # Date 1413421407 25200 # Node ID aeb8c2e6d83a616041834376747132f1f90f2413 # Parent 2a416391ffc3a210586643e9d81b374c4b3b4447 add queue to buffer monitor socket writes to prevent blocking on socket output stream write diff -r 2a416391ffc3 -r aeb8c2e6d83a src/com/five_ten_sg/connectbot/service/TerminalMonitor.java --- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Wed Oct 15 18:00:06 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Wed Oct 15 18:03:27 2014 -0700 @@ -95,17 +95,17 @@ } } catch (InterruptedException e) { - if (!is_closing) Log.e(TAG, "exception in monitorWrite()", e); + if (!is_closing) Log.e(TAG, "exception in MyWriter.run()", e); } catch (IOException e) { - Log.i(TAG, "exception in monitorWrite(), monitor died or closed the socket", e); + Log.i(TAG, "exception in MyWriter.run(), monitor died or closed the socket", e); } try { monitor_out.close(); } - catch (IOException ee) { - Log.e(TAG, "exception in monitorWrite() closing output stream", ee); + catch (IOException e) { + Log.e(TAG, "exception in MyWriter.run() closing output stream", e); } monitor_out = null; } @@ -348,9 +348,14 @@ public void monitorWrite(char cmd, char[] c) { - c[0] = (char)(c.length - 1); // number of chars following - c[1] = cmd; - pending_commands.put(c); + try { + c[0] = (char)(c.length - 1); // number of chars following + c[1] = cmd; + pending_commands.put(c); + } + catch (InterruptedException e) { + Log.e(TAG, "exception in monitorWrite()", e); + } }; public void resetWatch() {