You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by "mike-jumper (via GitHub)" <gi...@apache.org> on 2023/09/12 22:09:02 UTC

[GitHub] [guacamole-server] mike-jumper commented on a diff in pull request #459: GUACAMOLE-1846: Skip user promotion entirely if there are no pending users.

mike-jumper commented on code in PR #459:
URL: https://github.com/apache/guacamole-server/pull/459#discussion_r1323647626


##########
src/libguac/client.c:
##########
@@ -185,6 +185,12 @@ static void guac_client_promote_pending_users(union sigval data) {
     /* Acquire the lock for reading and modifying the list of pending users */
     guac_rwlock_acquire_write_lock(&(client->__pending_users_lock));
 
+    /* Skip user promotion entirely if there's no pending users */
+    if (client->__pending_users == NULL) {
+        guac_rwlock_release_lock(&(client->__pending_users_lock));
+        goto promotion_complete;

Review Comment:
   To be more DRY, should the same be done for:
   
   https://github.com/apache/guacamole-server/blob/974816a5caae45f5ecde5b4f2b258b9a513f2c06/src/libguac/client.c#L200-L205



##########
src/libguac/client.c:
##########
@@ -185,6 +185,12 @@ static void guac_client_promote_pending_users(union sigval data) {
     /* Acquire the lock for reading and modifying the list of pending users */
     guac_rwlock_acquire_write_lock(&(client->__pending_users_lock));
 
+    /* Skip user promotion entirely if there's no pending users */
+    if (client->__pending_users == NULL) {
+        guac_rwlock_release_lock(&(client->__pending_users_lock));

Review Comment:
   Any reason to not move the `promotion_complete` label up a line and rely on the `guac_rwlock_release_lock()` call that already exists there?



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

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org