1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

smp: helgrind and sai lock fixes

This commit is contained in:
Andy Green 2020-04-15 20:57:00 +01:00
parent eca75ee14d
commit a8eebc47a5
6 changed files with 15 additions and 14 deletions

View file

@ -372,7 +372,7 @@ __remove_wsi_socket_from_fds(struct lws *wsi)
return -1;
#endif
lws_same_vh_protocol_remove(wsi);
__lws_same_vh_protocol_remove(wsi);
/* the guy who is to be deleted's slot index in pt->fds */
m = wsi->position_in_fds_table;

View file

@ -1388,7 +1388,7 @@ lws_async_dns_deinit(lws_async_dns_t *dns);
int
lws_protocol_init_vhost(struct lws_vhost *vh, int *any);
int
_lws_generic_transaction_completed_active_conn(struct lws **wsi);
_lws_generic_transaction_completed_active_conn(struct lws **wsi, char take_vh_lock);
#define ACTIVE_CONNS_SOLO 0
#define ACTIVE_CONNS_MUXED 1

View file

@ -1506,7 +1506,7 @@ lws_vhost_active_conns(struct lws *wsi, struct lws **nwsi, const char *adsin)
if (lwsi_state(w) == LRS_IDLING) {
// lwsi_set_state(w, LRS_ESTABLISHED);
_lws_generic_transaction_completed_active_conn(&w);
_lws_generic_transaction_completed_active_conn(&w, 0);
}
//lwsi_set_state(w, LRS_H1C_ISSUE_HANDSHAKE2);
@ -1560,7 +1560,7 @@ lws_vhost_active_conns(struct lws *wsi, struct lws **nwsi, const char *adsin)
if (lwsi_state(w) == LRS_IDLING) {
// lwsi_set_state(w, LRS_ESTABLISHED);
_lws_generic_transaction_completed_active_conn(&w);
_lws_generic_transaction_completed_active_conn(&w, 0);
}
/*

View file

@ -761,7 +761,7 @@ lws_get_context(const struct lws *wsi)
#if defined(LWS_WITH_CLIENT)
int
_lws_generic_transaction_completed_active_conn(struct lws **_wsi)
_lws_generic_transaction_completed_active_conn(struct lws **_wsi, char take_vh_lock)
{
struct lws *wnew, *wsi = *_wsi;
@ -808,7 +808,8 @@ _lws_generic_transaction_completed_active_conn(struct lws **_wsi)
* closing ourself
*/
lws_vhost_lock(wsi->vhost);
if (take_vh_lock)
lws_vhost_lock(wsi->vhost);
wnew = lws_container_of(wsi->dll2_cli_txn_queue_owner.head, struct lws,
dll2_cli_txn_queue);
@ -891,7 +892,8 @@ _lws_generic_transaction_completed_active_conn(struct lws **_wsi)
} lws_end_foreach_dll_safe(d, d1);
lws_vhost_unlock(wsi->vhost);
if (take_vh_lock)
lws_vhost_unlock(wsi->vhost);
/*
* The original leader who passed on all his powers already can die...

View file

@ -1075,6 +1075,10 @@ lws_context_destroy3(struct lws_context *context)
lws_system_blob_destroy(
lws_system_get_blob(context, n, 0));
#if LWS_MAX_SMP > 1
lws_mutex_refcount_destroy(&context->mr);
#endif
lws_free(context);
lwsl_info("%s: ctx %p freed\n", __func__, context);
@ -1197,14 +1201,11 @@ lws_context_destroy2(struct lws_context *context)
lws_check_deferred_free(context, 0, 1);
#endif
lws_context_unlock(context); /* } context ------ */
#if LWS_MAX_SMP > 1
lws_mutex_refcount_destroy(&context->mr);
#endif
#if defined(LWS_WITH_NETWORK)
if (context->event_loop_ops->destroy_context2)
if (context->event_loop_ops->destroy_context2(context)) {
lws_context_unlock(context); /* } context ----------- */
context->finalize_destroy_after_internal_loops_stopped = 1;
return;
}
@ -1216,12 +1217,10 @@ lws_context_destroy2(struct lws_context *context)
for (n = 0; n < context->count_threads; n++)
if (context->pt[n].inside_service) {
lwsl_debug("%p: bailing as inside service\n", __func__);
lws_context_unlock(context); /* } context --- */
return;
}
}
#endif
lws_context_unlock(context); /* } context ------------------- */
lws_context_destroy3(context);
}

View file

@ -510,7 +510,7 @@ lws_http_transaction_completed_client(struct lws *wsi)
* For h1, wsi may pass some assets on to a queued child and be
* destroyed during this.
*/
n = _lws_generic_transaction_completed_active_conn(&wsi);
n = _lws_generic_transaction_completed_active_conn(&wsi, 1);
if (wsi->http.ah) {
if (wsi->client_mux_substream)