From 675c1b3bad107fdf723916e55388f83b8eb79a95 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Wed, 2 Apr 2025 11:56:13 +0200 Subject: [PATCH] MT#62272 AutoTest: introduce rcv_maybe() A dummy function to ignore the fact whether RTP packet(s) received or not. Useful in a combination with rcv_no(). Change-Id: Iaeea881e0a3590808dcc681495095178cb470b94 --- perl/NGCP/Rtpengine/AutoTest.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/perl/NGCP/Rtpengine/AutoTest.pm b/perl/NGCP/Rtpengine/AutoTest.pm index 4356d5f1f..696800090 100644 --- a/perl/NGCP/Rtpengine/AutoTest.pm +++ b/perl/NGCP/Rtpengine/AutoTest.pm @@ -20,7 +20,7 @@ our $launch_cb; BEGIN { require Exporter; @ISA = qw(Exporter); - our @EXPORT = qw(autotest_start new_call new_call_nc offer answer ft tt cid snd srtp_snd rtp rcv srtp_rcv rcv_no + our @EXPORT = qw(autotest_start new_call new_call_nc offer answer ft tt cid snd srtp_snd rtp rcv srtp_rcv rcv_no rcv_maybe srtp_dec escape rtpm rtpmre reverse_tags new_ft new_tt crlf sdp_split rtpe_req offer_answer autotest_init subscribe_request subscribe_answer publish use_json); }; @@ -258,6 +258,13 @@ sub rcv_no { my $addr = $sock->recv($p, 65535, &MSG_DONTWAIT); ok(! defined $addr, "no packet received"); } +sub rcv_maybe { + my ($sock) = @_; + Time::HiRes::sleep(0.1); + my $p = ''; + my $addr = $sock->recv($p, 65535, &MSG_DONTWAIT); + ok(1, "whatever packet received or not"); +} sub srtp_rcv { my ($sock, $port, $match, $srtp_ctx) = @_; return rcv($sock, $port, $match, \&srtp_dec, $srtp_ctx);