Github user ramkatru commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1845#discussion_r104242930
  
    --- Diff: 
services/console-proxy-rdp/rdpconsole/src/main/java/streamer/apr/AprSocketSource.java
 ---
    @@ -103,44 +103,46 @@ public void poll(boolean block) {
                 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, 5000000);
    +            int actualLength;
    +            if(block) {
    +                // Blocking read
    +                actualLength = Socket.recv(socket, buf.data, buf.offset, 
buf.data.length - buf.offset);
    +            } else {
    +                // non blocking read with 5 seconds timeout
    +                Socket.timeoutSet(socket, 5000000);
    +                actualLength = Socket.recv(socket, buf.data, buf.offset, 
buf.data.length - buf.offset);
    --- End diff --
    
    @anshul1886 can you please verify if timeout can be set on a socket that is 
not opened with APR_SO_NONBLOCK flag?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to