mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Fixed CPU usage with Java process, fixed buffering resize issue (manifests as initial blank screen)
This commit is contained in:
@@ -79,13 +79,13 @@ public class GuacamoleClient extends Client {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// While we're blocking, or input is available
|
// While we're blocking, or input is available
|
||||||
while (blocking || input.ready()) {
|
do {
|
||||||
|
|
||||||
// If past threshold, resize buffer before reading
|
// If past threshold, resize buffer before reading
|
||||||
if (usedLength > buffer.length/2) {
|
if (usedLength > buffer.length/2) {
|
||||||
char[] newbuffer = new char[buffer.length*2];
|
char[] biggerBuffer = new char[buffer.length*2];
|
||||||
System.arraycopy(newbuffer, 0, buffer, 0, usedLength);
|
System.arraycopy(buffer, 0, biggerBuffer, 0, usedLength);
|
||||||
buffer = newbuffer;
|
buffer = biggerBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to fill buffer
|
// Attempt to fill buffer
|
||||||
@@ -122,7 +122,7 @@ public class GuacamoleClient extends Client {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End read loop
|
} while (input.ready()); // End read loop
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
Reference in New Issue
Block a user