necouchman commented on a change in pull request #228:
URL: https://github.com/apache/guacamole-server/pull/228#discussion_r448471642



##########
File path: src/libguac/client.c
##########
@@ -478,6 +478,29 @@ int guac_client_load_plugin(guac_client* client, const 
char* protocol) {
 
 }
 
+int guac_client_owner_send_required(guac_client* client, const char** 
required) {
+
+    /* Don't send require instruction if client does not support it. */
+    if (!guac_client_supports_require(client))
+        return -1;
+    
+    int retval;
+
+    pthread_rwlock_rdlock(&(client->__users_lock));
+
+    /* Invoke callback with current owner */
+    retval = guac_protocol_send_required(client->__owner->socket, required);
+    
+    /* Flush the socket */
+    guac_socket_flush(client->__owner->socket);
+
+    pthread_rwlock_unlock(&(client->__users_lock));

Review comment:
       So, the only thing that I'm struggling with here is the callback - the 
current specification for the callback allows for the one `void *` data field, 
which I need to use to pass the required parameters through.  I haven't figured 
out a good way to get the `int` return value of the underlying 
`guac_protocol_send_required()` function to pass through the `void *` return 
value of the callback function.
   
   FWIW, I'm not sure how much it really matters to track the return value of 
`guac_protocol_send_required()` - in the all of the places where it was used 
directly in the past I don't think I ever made any use of the return value, but 
it makes me a little twitchy to have a function that returns something that 
just never gets looked at.
   
   Hints or opinions on the best way to handle this, all-around?




----------------------------------------------------------------
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]


Reply via email to