necouchman commented on a change in pull request #219: GUACAMOLE-422: Add 
timezone to client handshake
URL: https://github.com/apache/guacamole-server/pull/219#discussion_r270682536
 
 

 ##########
 File path: src/libguac/user-handshake.c
 ##########
 @@ -171,6 +171,80 @@ static void guac_free_mimetypes(char** mimetypes) {
 
 }
 
+/* Guacamole handshake handler functions. */
+
+int __guac_handshake_size_handler(guac_user* user, int argc, char** argv) {
+    
+    /* Validate size of instruction. */
+    if (argc < 2) {
+        guac_user_log(user, GUAC_LOG_ERROR, "Received \"size\" "
+                "instruction lacked required arguments.");
+        return 1;
+    }
+    
+    /* Parse optimal screen dimensions from size instruction */
+    user->info.optimal_width  = atoi(argv[0]);
+    user->info.optimal_height = atoi(argv[1]);
+
+    /* If DPI given, set the user resolution */
+    if (argc >= 3)
+        user->info.optimal_resolution = atoi(argv[2]);
+
+    /* Otherwise, use a safe default for rough backwards compatibility */
+    else
+        user->info.optimal_resolution = 96;
+    
+    return 0;
+    
+}
+
+int __guac_handshake_audio_handler(guac_user* user, int argc, char** argv) {
+    
+    /* Store audio mimetypes */
+    user->info.audio_mimetypes = (const char**) guac_copy_mimetypes(argv, 
argc);
 
 Review comment:
   Yeah, tried a couple of other things, here, and every time I try to run 
`guac_free_mimetypes()` within the handler function it just hangs.  Looks like 
probably an endless loop, but it's hard to say - the `size` instruction gets 
processed as it should, but as soon as it hits the `audio` instruction it hangs 
and doesn't go any further.  If I take out the `guac_free_mimetypes()` call it 
behaves fine, but that doesn't resolve memory leak concerns.  I also tried 
settings those mimetypes arrays to NULL at the beginning of the 
`guac_handle_connection()` function, but that didn't seem to help, either.
   
   I'm sure I'm missing something simple...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to