Skip to content
Snippets Groups Projects
Commit 813b2bc7 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

tcp-handler: cleanup rcu lock scope

parent 16613363
Branches
Tags
No related merge requests found
...@@ -339,14 +339,14 @@ static int tcp_wait_for_events(tcp_context_t *tcp) ...@@ -339,14 +339,14 @@ static int tcp_wait_for_events(tcp_context_t *tcp)
/* Mark the time of last poll call. */ /* Mark the time of last poll call. */
time_now(&tcp->last_poll_time); time_now(&tcp->last_poll_time);
bool is_throttled = (tcp->last_poll_time.tv_sec < tcp->throttle_end.tv_sec); bool is_throttled = (tcp->last_poll_time.tv_sec < tcp->throttle_end.tv_sec);
rcu_read_lock();
if (!is_throttled) { if (!is_throttled) {
/* Configuration limit, infer maximal pool size. */ /* Configuration limit, infer maximal pool size. */
rcu_read_lock();
unsigned max_per_set = MAX(conf()->max_tcp_clients / conf_tcp_threads(conf()), 1); unsigned max_per_set = MAX(conf()->max_tcp_clients / conf_tcp_threads(conf()), 1);
rcu_read_unlock();
/* Subtract master sockets check limits. */ /* Subtract master sockets check limits. */
is_throttled = (set->n - tcp->client_threshold) >= max_per_set; is_throttled = (set->n - tcp->client_threshold) >= max_per_set;
} }
rcu_read_unlock();
/* Process events. */ /* Process events. */
unsigned i = 0; unsigned i = 0;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment