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

smp: add pt lock on client connect path

This commit is contained in:
Andy Green 2020-08-31 09:27:16 +01:00
parent 16e8fc2042
commit e3e177a7d6
3 changed files with 11 additions and 3 deletions

View file

@ -714,8 +714,8 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
case LWS_HPI_RET_HANDLED:
break;
case LWS_HPI_RET_PLEASE_CLOSE_ME:
lwsl_notice("%s: %s pollin says please close me\n", __func__,
wsi->role_ops->name);
//lwsl_notice("%s: %s pollin says please close me\n", __func__,
// wsi->role_ops->name);
close_and_handled:
lwsl_debug("%p: Close and handled\n", wsi);
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,

View file

@ -375,6 +375,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY |
LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE);
#endif
struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
const struct sockaddr *psa = NULL;
uint16_t port = wsi->c_port;
const char *cce, *iface;
@ -652,8 +653,12 @@ ads_known:
if (wsi->a.context->event_loop_ops->sock_accept(wsi))
goto try_next_result_closesock;
if (__insert_wsi_socket_into_fds(wsi->a.context, wsi))
lws_pt_lock(pt, __func__);
if (__insert_wsi_socket_into_fds(wsi->a.context, wsi)) {
lws_pt_unlock(pt);
goto try_next_result_closesock;
}
lws_pt_unlock(pt);
/*
* The fd + wsi combination is entered into the wsi tables

View file

@ -508,6 +508,7 @@ bail3:
int LWS_WARN_UNUSED_RESULT
lws_http_transaction_completed_client(struct lws *wsi)
{
struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
int n;
lwsl_info("%s: wsi: %p (%s)\n", __func__, wsi, wsi->a.protocol->name);
@ -526,7 +527,9 @@ 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.
*/
lws_pt_lock(pt, __func__);
n = _lws_generic_transaction_completed_active_conn(&wsi, 1);
lws_pt_unlock(pt);
if (wsi->http.ah) {
if (wsi->client_mux_substream)