MT#56447 simplify handle removal

No need to do the key lookup twice.

Change-Id: Icb940d456656829d8c804773235d7ec20b76df65
pull/1642/head
Richard Fuchs 3 years ago
parent a789afa548
commit baa617e446

@ -1329,13 +1329,11 @@ const char *janus_detach(struct websocket_message *wm, JsonReader *reader, JsonB
{ {
LOCK(&session->lock); LOCK(&session->lock);
void *exists = g_hash_table_lookup(session->handles, &handle_id); bool exists = g_hash_table_remove(session->handles, &handle_id);
*retcode = 463; *retcode = 463;
if (!exists) if (!exists)
return "Could not detach handle from plugin"; return "Could not detach handle from plugin";
g_hash_table_remove(session->handles, &handle_id);
} }
LOCK(&janus_lock); LOCK(&janus_lock);

Loading…
Cancel
Save