When shutting down in `generic_server`, connections are now closed in two steps.
First, only the RX (receive) side is shut down. Then, after all ongoing requests
are completed, or a timeout happened the connections are fully closed.
Fixes scylladb/scylladb#24481
(cherry picked from commit ea311be12b)
38 lines
927 B
C++
38 lines
927 B
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 "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() : server("test_server", test_logger, 30) {};
|
|
protected:
|
|
[[noreturn]] shared_ptr<connection> make_connection(socket_address, connected_socket&&, socket_address) {
|
|
SCYLLA_ASSERT(false);
|
|
}
|
|
};
|
|
|
|
SEASTAR_TEST_CASE(stop_without_listening) {
|
|
test_server srv;
|
|
co_await with_timeout(lowres_clock::now() + 5min, srv.stop());
|
|
}
|