diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-01-13 16:33:33 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-01-13 16:33:33 +0100 |
commit | 1bbbac7f62d71f0d0c4c71d429aeb2cfdf96e5ac (patch) | |
tree | f9234c8e6491151fddccc2c8d1ff0b0600c44c5f /lib/UdpSocket.h | |
parent | 7c8ae25ba83fc658dfbe4cd468bb1bdfd3513c74 (diff) | |
download | dabmod-1bbbac7f62d71f0d0c4c71d429aeb2cfdf96e5ac.tar.gz dabmod-1bbbac7f62d71f0d0c4c71d429aeb2cfdf96e5ac.tar.bz2 dabmod-1bbbac7f62d71f0d0c4c71d429aeb2cfdf96e5ac.zip |
EDI: add protection against runaway memory usage
Diffstat (limited to 'lib/UdpSocket.h')
-rw-r--r-- | lib/UdpSocket.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/UdpSocket.h b/lib/UdpSocket.h index 81a7d2b..8c968d2 100644 --- a/lib/UdpSocket.h +++ b/lib/UdpSocket.h @@ -184,7 +184,7 @@ class UdpReceiver { UdpReceiver operator=(const UdpReceiver&) = delete; // Start the receiver in a separate thread - void start(int port); + void start(int port, size_t max_packets_queued); // Get the data contained in a UDP packet, blocks if none available // In case of error, throws a runtime_error @@ -194,6 +194,7 @@ class UdpReceiver { void m_run(void); int m_port; + size_t m_max_packets_queued; std::thread m_thread; std::atomic<bool> m_stop; ThreadsafeQueue<UdpPacket> m_packets; |