Mercurial > 510Connectbot
comparison 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 |
comparison
equal
deleted
inserted
replaced
397:2f2b5a244a4d | 398:2a416391ffc3 |
---|---|
88 public void run() { | 88 public void run() { |
89 char [] c; | 89 char [] c; |
90 try { | 90 try { |
91 while (!is_closing) { | 91 while (!is_closing) { |
92 c = pending_commands.take(); | 92 c = pending_commands.take(); |
93 c[0] = (char)(c.length - 1); // number of chars following | 93 //Log.i(TAG, String.format("sending %d command", (int)c[1])); |
94 c[1] = cmd; | |
95 //Log.i(TAG, String.format("sending %d command", (int)cmd)); | |
96 monitor_out.write(charsToBytes(c)); | 94 monitor_out.write(charsToBytes(c)); |
97 } | 95 } |
98 } | 96 } |
99 catch (InterruptedException e) { | 97 catch (InterruptedException e) { |
100 if (!is_closing) Log.e(TAG, "exception in monitorWrite()", e); | 98 if (!is_closing) Log.e(TAG, "exception in monitorWrite()", e); |
348 return b; | 346 return b; |
349 } | 347 } |
350 | 348 |
351 | 349 |
352 public void monitorWrite(char cmd, char[] c) { | 350 public void monitorWrite(char cmd, char[] c) { |
351 c[0] = (char)(c.length - 1); // number of chars following | |
353 c[1] = cmd; | 352 c[1] = cmd; |
354 pending_commands.put(c); | 353 pending_commands.put(c); |
355 }; | 354 }; |
356 | 355 |
357 public void resetWatch() { | 356 public void resetWatch() { |