diff src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 398:2a416391ffc3

add queue to buffer monitor socket writes to prevent blocking on socket output stream write
author Carl Byington <carl@five-ten-sg.com>
date Wed, 15 Oct 2014 18:00:06 -0700
parents 2f2b5a244a4d
children aeb8c2e6d83a
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Wed Oct 15 17:55:59 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Wed Oct 15 18:00:06 2014 -0700
@@ -90,9 +90,7 @@
             try {
                 while (!is_closing) {
                     c = pending_commands.take();
-                    c[0] = (char)(c.length - 1);    // number of chars following
-                    c[1] = cmd;
-                    //Log.i(TAG, String.format("sending %d command", (int)cmd));
+                    //Log.i(TAG, String.format("sending %d command", (int)c[1]));
                     monitor_out.write(charsToBytes(c));
                 }
             }
@@ -350,6 +348,7 @@
 
 
     public void monitorWrite(char cmd, char[] c) {
+        c[0] = (char)(c.length - 1);    // number of chars following
         c[1] = cmd;
         pending_commands.put(c);
     };