Skip to content

Commit

Permalink
Fix "off by one" error figuring out failed subcommand.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Jul 24, 2024
1 parent 0814429 commit d2f0be8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sippy/Rtp_proxy/Session/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit d2f0be8

Please sign in to comment.