From d2f0be8318386efdb6e99615298d8a4a8dd0703e Mon Sep 17 00:00:00 2001 From: Maksym Sobolyev Date: Tue, 23 Jul 2024 14:58:38 -0700 Subject: [PATCH] Fix "off by one" error figuring out failed subcommand. --- sippy/Rtp_proxy/Session/update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sippy/Rtp_proxy/Session/update.py b/sippy/Rtp_proxy/Session/update.py index 3a9e32fc4..dd934b20f 100644 --- a/sippy/Rtp_proxy/Session/update.py +++ b/sippy/Rtp_proxy/Session/update.py @@ -53,13 +53,13 @@ def process_rtpp_result(self, result): return ur = update_result() if len(self.subcommands) > 0: - expected = sum([1 for sc in self.subcommands for _ in sc.commands]) if len(t0) > 1: subc_ress = [x.strip() for x in t0[1].split('&&')] actual = len(subc_ress) else: subc_ress = [] actual = 0 + expected = sum(len(sc.commands) for sc in self.subcommands) if actual > expected: ex = RtpProxyError(f'RTPProxy errored: too many results, {actual=}, {expected=}') self.result_callback(None, self.rtpps, ex=ex) @@ -70,7 +70,7 @@ def process_rtpp_result(self, result): if foff > len(subc.commands): foff -= len(subc.commands) continue - ex = RtpProxyError(f'RTPProxy errored: {subc.commands[foff]}: {subc_ress[-1]}') + ex = RtpProxyError(f'RTPProxy errored: {subc.commands[foff - 1]}: {subc_ress[-1]}') self.result_callback(None, self.rtpps, ex=ex) return None if actual < expected: