Before this change, new connections were handled in a default scheduling group (`main`), because before the user is authenticated we do not know which service level should be used. With the new `sl:driver` service level, creation of new connections can be moved to `sl:driver`. We switch the service level as early as possible, in `do_accepts`. There is a possibility, that `sl:driver` will not exist yet, for instance, in specific upgrade cases, or if it was removed. Therefore, we also switch to `sl:driver` after a connection is accepted. Refs: scylladb/scylladb#24411
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
/*
|
|
* Copyright (C) 2024-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#include <chrono>
|
|
#include <seastar/core/lowres_clock.hh>
|
|
#include <seastar/core/with_timeout.hh>
|
|
#include <seastar/testing/test_case.hh>
|
|
#include <seastar/util/log.hh>
|
|
|
|
#include "transport/generic_server.hh"
|
|
#include "utils/assert.hh"
|
|
|
|
using namespace generic_server;
|
|
using namespace logging;
|
|
using namespace seastar;
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
static logger test_logger("test_server");
|
|
|
|
class test_server : public server {
|
|
public:
|
|
test_server(const utils::updateable_value_source<uint32_t>& c) : server("test_server", test_logger, config{utils::updateable_value<uint32_t>(c)}) {};
|
|
protected:
|
|
[[noreturn]] shared_ptr<connection> make_connection(socket_address, connected_socket&&, socket_address, named_semaphore& sem, semaphore_units<named_semaphore_exception_factory> initial_sem_units) override {
|
|
SCYLLA_ASSERT(false);
|
|
}
|
|
scheduling_group get_scheduling_group_for_new_connection() const override { return current_scheduling_group(); }
|
|
};
|
|
|
|
SEASTAR_TEST_CASE(stop_without_listening) {
|
|
utils::updateable_value_source<uint32_t> concurrency(1);
|
|
test_server srv(concurrency);
|
|
co_await with_timeout(lowres_clock::now() + 5min, srv.stop());
|
|
co_return;
|
|
}
|