diff options
author | Uros Majstorovic <majstor@majstor.org> | 2024-04-29 11:14:23 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2024-04-29 11:14:23 +0200 |
commit | 3e9b350110357e7b9555ad910986dc53edf554ad (patch) | |
tree | 94ae33943047fa8aa831e7f0e33c578d00fd3e8e | |
parent | 38fdc24c2cc0c942337481e825c69004c93fc358 (diff) |
fixed potential deadlock
-rw-r--r-- | ecp/src/ecp/vconn/vconn.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ecp/src/ecp/vconn/vconn.c b/ecp/src/ecp/vconn/vconn.c index 39da365..337c693 100644 --- a/ecp/src/ecp/vconn/vconn.c +++ b/ecp/src/ecp/vconn/vconn.c @@ -114,13 +114,17 @@ static ssize_t handle_relay(ECPConnection *conn, unsigned char *msg, size_t msg_ if (_idx != vconn->vconn_next_curr) insert_next = 1; if (vconn->vlink_next.valid) conn_next = ecp_ht_search(sock->vconn_table.vlink_keys, &vconn->vlink_next.public); + +#ifdef ECP_WITH_PTHREAD + pthread_mutex_unlock(&conn->mutex); +#endif + if (conn_next) { _rv = ecp_conn_refcount_inc(conn_next); if (_rv) conn_next = NULL; } #ifdef ECP_WITH_PTHREAD - pthread_mutex_unlock(&conn->mutex); pthread_mutex_unlock(&sock->vconn_table.vlink_keys_mutex); #endif |