mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6898: [Hyper-V] fixed rdp console freezing during reboot.
Console was freezing because we read data from socket in blocking mode. During reboot it was blocking infintely. To fix issue, now we are reading data in non-blocking mode. In non-blocking mode I set the timeout to 5 seconds.
This commit is contained in:
parent
63ea596ba2
commit
4c9507d21e
@ -371,7 +371,7 @@ public class SyncLink implements Link {
|
||||
// Pull source in loop
|
||||
while (!shutdown) {
|
||||
// Pull data from source element and send it to sink element
|
||||
ByteBuffer data = pull(true);
|
||||
ByteBuffer data = pull(false);
|
||||
if (data != null)
|
||||
sink.handleData(data, this);
|
||||
|
||||
|
||||
@ -101,20 +101,23 @@ public class AprSocketSource extends BaseElement {
|
||||
if (verbose)
|
||||
System.out.println("[" + this + "] INFO: Reading data from stream.");
|
||||
|
||||
// to unblock during reboot
|
||||
long startTime = System.currentTimeMillis();
|
||||
// FIXME: If pull is destroyed or socket is closed, segfault will happen here
|
||||
int actualLength = (block) ? // Blocking read
|
||||
Socket.recv(socket, buf.data, buf.offset, buf.data.length - buf.offset)
|
||||
: // Non-blocking read
|
||||
Socket.recvt(socket, buf.data, buf.offset, buf.data.length - buf.offset, 1);
|
||||
Socket.recvt(socket, buf.data, buf.offset, buf.data.length - buf.offset, 5000000);
|
||||
|
||||
if (socketWrapper.shutdown) {
|
||||
socketWrapper.destroyPull();
|
||||
return;
|
||||
}
|
||||
|
||||
if (actualLength < 0) {
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
if (actualLength < 0 || elapsedTime > 5000) {
|
||||
if (verbose)
|
||||
System.out.println("[" + this + "] INFO: End of stream.");
|
||||
System.out.println("[" + this + "] INFO: End of stream or timeout");
|
||||
|
||||
buf.unref();
|
||||
closeStream();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user