diff --git a/server/core/worker.cc b/server/core/worker.cc index ff7cd61df..8b0275cd1 100644 --- a/server/core/worker.cc +++ b/server/core/worker.cc @@ -214,6 +214,16 @@ bool Worker::init() MXS_ERROR("Could not allocate an epoll instance."); } + if (this_unit.initialized) + { + // When the initialization has successfully been performed, we set the + // current_worker_id of this thread to 0. That way any connections that + // are made during service startup (after this function returns, but + // bofore the workes have been started) will be handled by the worker + // that will be running in the main thread. + this_thread.current_worker_id = 0; + } + return this_unit.initialized; }