mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-02 23:54:12 +02:00
Add stop capability to UDPRecvModule
This commit is contained in:
@@ -19,7 +19,7 @@ class UdpRecvModule {
|
||||
public:
|
||||
UdpRecvModule(RingBuffer<UdpFrameMetadata>& ring_buffer);
|
||||
|
||||
virtual ~UdpRecvModule() = default;
|
||||
virtual ~UdpRecvModule();
|
||||
|
||||
void start_recv(
|
||||
const uint16_t udp_port,
|
||||
|
||||
@@ -12,6 +12,11 @@ UdpRecvModule::UdpRecvModule(RingBuffer<UdpFrameMetadata>& ring_buffer) :
|
||||
|
||||
}
|
||||
|
||||
UdpRecvModule::~UdpRecvModule()
|
||||
{
|
||||
stop_recv();
|
||||
}
|
||||
|
||||
void UdpRecvModule::start_recv(
|
||||
const uint16_t udp_port,
|
||||
const size_t udp_buffer_n_bytes)
|
||||
@@ -49,6 +54,23 @@ void UdpRecvModule::start_recv(
|
||||
udp_buffer_n_bytes);
|
||||
}
|
||||
|
||||
void UdpRecvModule::stop_recv()
|
||||
{
|
||||
#ifdef DEBUG_OUTPUT
|
||||
using namespace date;
|
||||
using namespace chrono;
|
||||
cout << "[" << system_clock::now() << "]";
|
||||
cout << "UdpRecvModule::stop_recv";
|
||||
cout << " Stop receiving." << endl;
|
||||
#endif
|
||||
|
||||
is_receiving_ = false;
|
||||
|
||||
if (receiving_thread_.joinable()) {
|
||||
receiving_thread_.join();
|
||||
}
|
||||
}
|
||||
|
||||
void UdpRecvModule::receive_thread(
|
||||
const uint16_t udp_port,
|
||||
const size_t udp_buffer_n_bytes)
|
||||
|
||||
Reference in New Issue
Block a user