# HG changeset patch # User Carl Byington # Date 1405014249 25200 # Node ID 2626bf2a8cea0f45beda563df4fdea71a72fafba # Parent 83d633b281cbaabfa0eaebf385538b492745766b delay testChanged() by 10ms for async transports diff -r 83d633b281cb -r 2626bf2a8cea src/com/five_ten_sg/connectbot/service/Relay.java --- a/src/com/five_ten_sg/connectbot/service/Relay.java Wed Jul 09 15:23:30 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/Relay.java Thu Jul 10 10:44:09 2014 -0700 @@ -111,7 +111,11 @@ int offset; int charWidth; Timer timer = new Timer("relay.blocker", true); - TimerTask task = null; + TimerTask task = new TimerTask() { + public void run() { + buffer.testChanged(); + } + }; try { while (true) { @@ -120,20 +124,11 @@ offset = byteBuffer.arrayOffset() + byteBuffer.limit(); if (transport.willBlock()) { - task = new TimerTask() { - public void run() { - buffer.testChanged(); - } - }; timer.schedule(task, 10); // 10 ms delay } bytesRead = transport.read(byteArray, offset, bytesToRead); - - if (task != null) { - task.cancel(); - task = null; - } + task.cancel(); if (bytesRead > 0) { byteBuffer.limit(byteBuffer.limit() + bytesRead);