aboutsummaryrefslogtreecommitdiffstats
path: root/gr-network/python/network/qa_udp_source.py
diff options
context:
space:
mode:
authorClayton Smith <argilo@gmail.com>2021-12-07 08:16:46 -0500
committermormj <34754695+mormj@users.noreply.github.com>2021-12-07 09:20:21 -0500
commit35a242f1cd4b724be0c4708d8690f82c804aafd8 (patch)
treef426244a52dbacab59518698e0df3f1f3f166a9d /gr-network/python/network/qa_udp_source.py
parentgrc: modify and cleanup bokeh server loop (diff)
downloadgnuradio-35a242f1cd4b724be0c4708d8690f82c804aafd8.tar.xz
gnuradio-35a242f1cd4b724be0c4708d8690f82c804aafd8.zip
network: fix segfaults when TCP & UDP blocks are restarted
The TCP and UDP blocks segfault if start() is called after stop(), because stop() frees resources that are not re-allocated by start(). To fix this, I've moved resource allocation for these blocks from the constructor to start(). Signed-off-by: Clayton Smith <argilo@gmail.com>
Diffstat (limited to '')
-rw-r--r--gr-network/python/network/qa_udp_source.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/gr-network/python/network/qa_udp_source.py b/gr-network/python/network/qa_udp_source.py
new file mode 100644
index 000000000..67c76da99
--- /dev/null
+++ b/gr-network/python/network/qa_udp_source.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+#
+# Copyright 2021 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+
+from gnuradio import gr, gr_unittest, blocks, network
+import time
+
+
+class qa_udp_source (gr_unittest.TestCase):
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_restart(self):
+ udp_source = network.udp_source(gr.sizeof_gr_complex, 1, 1234, 0, 1472,
+ False, False, False)
+ null_sink = blocks.null_sink(gr.sizeof_gr_complex)
+ self.tb.connect(udp_source, null_sink)
+ self.tb.start()
+ time.sleep(0.1)
+ self.tb.stop()
+ time.sleep(0.1)
+ self.tb.start()
+ time.sleep(0.1)
+ self.tb.stop()
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_udp_source)