comparison src/com/five_ten_sg/connectbot/service/Relay.java @ 228:c9a7f33b53a8

delay testChanged() by 10ms for async transports
author Carl Byington <carl@five-ten-sg.com>
date Wed, 09 Jul 2014 09:05:05 -0700
parents 2dd627df4dfb
children 2626bf2a8cea
comparison
equal deleted inserted replaced
227:2dd627df4dfb 228:c9a7f33b53a8
118 charWidth = bridge.charWidth; 118 charWidth = bridge.charWidth;
119 bytesToRead = byteBuffer.capacity() - byteBuffer.limit(); 119 bytesToRead = byteBuffer.capacity() - byteBuffer.limit();
120 offset = byteBuffer.arrayOffset() + byteBuffer.limit(); 120 offset = byteBuffer.arrayOffset() + byteBuffer.limit();
121 121
122 if (transport.willBlock()) { 122 if (transport.willBlock()) {
123 task = new TimerTask(){ 123 task = new TimerTask() {
124 public void run() { 124 public void run() {
125 buffer.testChanged(); 125 buffer.testChanged();
126 } 126 }
127 }; 127 };
128 timer.schedule(task, 10); // 10 ms delay 128 timer.schedule(task, 10); // 10 ms delay
129 }
129 130
130 bytesRead = transport.read(byteArray, offset, bytesToRead); 131 bytesRead = transport.read(byteArray, offset, bytesToRead);
131 132
132 if (task != null) { 133 if (task != null) {
133 task.cancel(); 134 task.cancel();