          pass
  
      if w not in socks:
        socks[w] = messaging.pub_sock(w)
      socks[w].send(msg.to_bytes())
  
      lag += (next_msg.logMonoTime - msg.logMonoTime) / 1e9
      lag -= time.time() - start_time
  
      dt = max(lag, 0)
 
</s> remove     i = min(i + 1, max_i)
 </s> add     i = (i + 1) % max_i if loop else min(i + 1, max_i) </s> remove   lr = LogReader(f"cd:/{route}/{segment}/rlog.bz2")
  fr = FrameReader(f"cd:/{route}/{segment}/fcamera.hevc", readahead=True)
 </s> add   lr = LogReader(f"cd:/{route}/rlog.bz2")
  fr = FrameReader(f"cd:/{route}/fcamera.hevc", readahead=True) </s> remove def replay(route, segment):
 </s> add def replay(route, loop): </s> remove   parser.add_argument("route")
  parser.add_argument("segment", type=int)
 </s> add   parser.add_argument("--loop", action='store_true')
  parser.add_argument("segment") </s> remove     replay(args.route, args.segment)
 </s> add     replay(args.segment, args.loop)
    try:
      if socks[w]:
        socks[w].send(msg.to_bytes())
    except messaging.messaging_pyx.MultiplePublishersError:
      socks[w] = None
          pass
  
      if w not in socks:
        socks[w] = messaging.pub_sock(w)
    try:
      if socks[w]:
        socks[w].send(msg.to_bytes())
    except messaging.messaging_pyx.MultiplePublishersError:
      socks[w] = None
  
      lag += (next_msg.logMonoTime - msg.logMonoTime) / 1e9
      lag -= time.time() - start_time
  
      dt = max(lag, 0)
keep keep keep keep replace keep keep keep keep keep
 Handle loop and multiple publishers 
tools/replay/unlog_segment.py