You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/05/24 03:46:10 UTC
[3/5] incubator-guacamole-server git commit: GUACAMOLE-33: Restore
guac_common_cursor_remove_user() (reverts commit af7968e).
GUACAMOLE-33: Restore guac_common_cursor_remove_user() (reverts commit af7968e).
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/92e2f4e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/92e2f4e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/92e2f4e4
Branch: refs/heads/master
Commit: 92e2f4e42074693bdc540ec9d0ae7392c7771a65
Parents: 7e3c28a
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Apr 18 18:53:12 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon May 23 13:58:30 2016 -0700
----------------------------------------------------------------------
src/common/guac_cursor.c | 9 +++++++++
src/common/guac_cursor.h | 15 +++++++++++++++
src/protocols/vnc/user.c | 9 +++++++++
src/protocols/vnc/user.h | 5 +++++
4 files changed, 38 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/92e2f4e4/src/common/guac_cursor.c
----------------------------------------------------------------------
diff --git a/src/common/guac_cursor.c b/src/common/guac_cursor.c
index e376ab0..4ed66b1 100644
--- a/src/common/guac_cursor.c
+++ b/src/common/guac_cursor.c
@@ -367,3 +367,12 @@ void guac_common_cursor_set_blank(guac_common_cursor* cursor) {
}
+void guac_common_cursor_remove_user(guac_common_cursor* cursor,
+ guac_user* user) {
+
+ /* Disassociate from given user */
+ if (cursor->user == user)
+ cursor->user = NULL;
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/92e2f4e4/src/common/guac_cursor.h
----------------------------------------------------------------------
diff --git a/src/common/guac_cursor.h b/src/common/guac_cursor.h
index ae359b7..9db7067 100644
--- a/src/common/guac_cursor.h
+++ b/src/common/guac_cursor.h
@@ -249,4 +249,19 @@ void guac_common_cursor_set_ibar(guac_common_cursor* cursor);
*/
void guac_common_cursor_set_blank(guac_common_cursor* cursor);
+/**
+ * Removes the given user, such that future synchronization will not occur.
+ * This is necessary when a user leaves the connection. If a user leaves the
+ * connection and this is not called, the corresponding guac_user and socket
+ * may cease to be valid, and future synchronization attempts will segfault.
+ *
+ * @param cursor
+ * The cursor to remove the user from.
+ *
+ * @param user
+ * The user to remove.
+ */
+void guac_common_cursor_remove_user(guac_common_cursor* cursor,
+ guac_user* user);
+
#endif
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/92e2f4e4/src/protocols/vnc/user.c
----------------------------------------------------------------------
diff --git a/src/protocols/vnc/user.c b/src/protocols/vnc/user.c
index 0b89d7c..53423a1 100644
--- a/src/protocols/vnc/user.c
+++ b/src/protocols/vnc/user.c
@@ -97,3 +97,12 @@ int guac_vnc_user_join_handler(guac_user* user, int argc, char** argv) {
}
+int guac_vnc_user_leave_handler(guac_user* user) {
+
+ guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
+
+ guac_common_cursor_remove_user(vnc_client->display->cursor, user);
+
+ return 0;
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/92e2f4e4/src/protocols/vnc/user.h
----------------------------------------------------------------------
diff --git a/src/protocols/vnc/user.h b/src/protocols/vnc/user.h
index 125e496..e74b2a0 100644
--- a/src/protocols/vnc/user.h
+++ b/src/protocols/vnc/user.h
@@ -29,5 +29,10 @@
*/
guac_user_join_handler guac_vnc_user_join_handler;
+/**
+ * Handler for leaving users.
+ */
+guac_user_leave_handler guac_vnc_user_leave_handler;
+
#endif