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

    https://github.com/apache/guacamole-server/pull/183#discussion_r216501462
  
    --- Diff: src/libguac/parser.c ---
    @@ -222,7 +222,11 @@ int guac_parser_read(guac_parser* parser, guac_socket* 
socket, int usec_timeout)
                 retval = guac_socket_select(socket, usec_timeout);
                 if (retval <= 0)
                     return -1;
    -           
    +            
    +            /* Reset pointers if instruction buf len is less than max 
instruction len */
    +            if (buffer_end - unparsed_end < GUAC_INSTRUCTION_MAX_LENGTH)
    +                unparsed_end = unparsed_start = parser->__instructionbuf;
    --- End diff --
    
    @mike-jumper All description lies in the jira ticket: 
https://issues.apache.org/jira/projects/GUACAMOLE/issues/GUACAMOLE-620
    
    Frist, all TCP traffic contains full instruction.
    
    Second, the following outputs:
    
    ```
    __write_all: 4.sync,8.76258350;
    __write_all: 5.mouse,3.445,3.261,1.1;
    guac_socket_fd_read_handler: 4.sync,8.76258�, length: 14
    guac_socket_fd_read_handler: 5.mouse,3.445,3.261,1.1;eo, length: 24
    ```
    
    `__write_all` in `guacd` successfully writes full instruction, somehow (no 
idea with system calls behavior),  `guac_socket_fd_read_handler` lost part of 
the instruction, and then reads next instruction.


---

Reply via email to