Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,34 @@ public void run() {
if (client.isVncOverWebSocketConnectionOpen()) {
updateFrontEndActivityTime();
}
connectionAlive = client.isVncOverWebSocketConnectionAlive();
connectionAlive = session.isOpen();
Comment thread
weizhouapache marked this conversation as resolved.
try {
Thread.sleep(1);
} catch (Exception e) {
s_logger.warn("Error on sleep for vnc over websocket", e);
} catch (InterruptedException e) {
s_logger.error("Error on sleep for vnc over websocket", e);
}
} else if (client.isVncOverNioSocket()) {
byte[] bytesArr;
int nextBytes = client.getNextBytes();
bytesArr = new byte[nextBytes];
client.readBytes(bytesArr, nextBytes);
s_logger.trace(String.format("Read [%s] bytes from client [%s]", nextBytes, clientId));
Comment thread
weizhouapache marked this conversation as resolved.
if (nextBytes > 0) {
session.getRemote().sendBytes(ByteBuffer.wrap(bytesArr));
updateFrontEndActivityTime();
} else {
connectionAlive = session.isOpen();
}
} else {
b = new byte[100];
readBytes = client.read(b);
s_logger.trace(String.format("Read [%s] bytes from client [%s]", readBytes, clientId));
Comment thread
JoaoJandre marked this conversation as resolved.
if (readBytes == -1 || (readBytes > 0 && !sendReadBytesToNoVNC(b, readBytes))) {
connectionAlive = false;
}
}
}
connectionAlive = false;
s_logger.info(String.format("Connection with client [%s] is dead.", clientId));
} catch (IOException e) {
s_logger.error("Error on VNC client", e);
}
Expand Down