Skip to content

Commit a751a6d

Browse files
frankistcodebot
authored andcommitted
cu-cp: stop() cu-cp from within cu-cp executor
1 parent bde1fe6 commit a751a6d

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

apps/gnb/gnb.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ int main(int argc, char** argv)
549549
// Stop CU-UP activity.
550550
cu_up_obj->stop();
551551

552+
// Stop CU-CP activity.
553+
cu_cp_obj->stop();
554+
552555
if (not gnb_cfg.amf_cfg.no_core) {
553556
gnb_logger.info("Closing network connections...");
554557
ngap_adapter->disconnect_gateway();

include/srsran/cu_cp/cu_cp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class cu_cp_interface : public cu_cp_ngap_connection_interface,
8080
virtual cu_cp_cu_up_connection_interface& get_cu_cp_cu_up_connection_interface() = 0;
8181

8282
virtual void start() = 0;
83+
virtual void stop() = 0;
8384
};
8485

8586
} // namespace srs_cu_cp

lib/cu_cp/cu_cp_impl.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,30 @@ void cu_cp_impl::start()
112112
}
113113
}
114114

115-
void cu_cp_impl::stop() {}
115+
void cu_cp_impl::stop()
116+
{
117+
logger.info("Stopping CU-CP...");
118+
std::promise<void> p;
119+
std::future<void> fut = p.get_future();
120+
121+
// Shut down components from within CU-CP executor.
122+
while (not cfg.cu_cp_executor->execute([this, &p]() {
123+
statistics_report_timer.stop();
124+
125+
routine_mng.reset();
126+
127+
// Signal back that CU-CP is stopped.
128+
p.set_value();
129+
})) {
130+
// Keep dispatching until the task is accepted.
131+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
132+
}
133+
134+
// Block waiting for CU-CP stop to complete.
135+
fut.wait();
136+
137+
logger.info("CU-CP stopped successfully.");
138+
}
116139

117140
size_t cu_cp_impl::get_nof_cu_ups() const
118141
{

lib/cu_cp/cu_cp_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class cu_cp_impl final : public cu_cp_interface, public cu_cp_impl_interface
3939
{
4040
public:
4141
explicit cu_cp_impl(const cu_cp_configuration& config_);
42-
~cu_cp_impl();
42+
~cu_cp_impl() override;
4343

4444
void start() override;
45-
void stop();
45+
void stop() override;
4646

4747
// CU-CP CU-UP interface
4848
size_t get_nof_cu_ups() const override;

0 commit comments

Comments
 (0)