mirror of
https://github.com/sonertari/SSLproxy
synced 2024-11-19 21:25:28 +00:00
Do not modify thr stats without locking, otherwise max fd stats were sometimes wrong
This commit is contained in:
parent
3147723774
commit
c43e359a1b
@ -2004,7 +2004,6 @@ pxy_conn_setup(evutil_socket_t fd,
|
||||
}
|
||||
|
||||
ctx->af = peeraddr->sa_family;
|
||||
ctx->thr->max_fd = MAX(ctx->thr->max_fd, ctx->fd);
|
||||
|
||||
/* determine original destination of connection */
|
||||
if (spec->natlookup) {
|
||||
|
@ -555,6 +555,7 @@ pxy_thrmgr_attach(pxy_conn_ctx_t *ctx)
|
||||
pthread_mutex_lock(&ctx->thr->mutex);
|
||||
ctx->thr->load++;
|
||||
ctx->thr->max_load = MAX(ctx->thr->max_load, ctx->thr->load);
|
||||
ctx->thr->max_fd = MAX(ctx->thr->max_fd, ctx->fd);
|
||||
// Defer adding the conn to the conn list of its thread until after a successful conn setup while returning from pxy_conn_connect()
|
||||
// otherwise pxy_thrmgr_timer_cb() may try to access the conn ctx while it is being freed on failure (signal 6 crash)
|
||||
pthread_mutex_unlock(&ctx->thr->mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user