@@ -485,24 +485,25 @@ def sendp(x, # type: _PacketIterable
485485
486486
487487@conf .commands .register
488- def sendpfast (x , # type: _PacketIterable
489- pps = None , # type: Optional[float]
490- mbps = None , # type: Optional[float]
491- realtime = False , # type: bool
492- loop = None , # type: Optional[int]
493- file_cache = False , # type: bool
494- iface = None , # type: Optional[_GlobInterfaceType]
495- replay_args = None , # type: Optional[List[str]]
496- parse_results = False , # type: bool
488+ def sendpfast (x : _PacketIterable ,
489+ pps : Optional [float ] = None ,
490+ mbps : Optional [float ] = None ,
491+ realtime : bool = False ,
492+ count : Optional [int ] = None ,
493+ loop : int = 0 ,
494+ file_cache : bool = False ,
495+ iface : Optional [_GlobInterfaceType ] = None ,
496+ replay_args : Optional [List [str ]] = None ,
497+ parse_results : bool = False ,
497498 ):
498499 # type: (...) -> Optional[Dict[str, Any]]
499500 """Send packets at layer 2 using tcpreplay for performance
500501
501502 :param pps: packets per second
502503 :param mbps: MBits per second
503504 :param realtime: use packet's timestamp, bending time with real-time value
504- :param loop: number of times to process the packet list. 0 implies
505- infinite loop
505+ :param loop: send the packet indefinitely (default 0)
506+ :param count: number of packets to send (default None=1)
506507 :param file_cache: cache packets in RAM instead of reading from
507508 disk at each iteration
508509 :param iface: output interface
@@ -523,8 +524,11 @@ def sendpfast(x, # type: _PacketIterable
523524 else :
524525 argv .append ("--topspeed" )
525526
526- if loop is not None :
527- argv .append ("--loop=%i" % loop )
527+ if count :
528+ assert not loop , "Can't use loop and count at the same time in sendpfast"
529+ argv .append ("--loop=%i" % count )
530+ elif loop :
531+ argv .append ("--loop=0" )
528532 if file_cache :
529533 argv .append ("--preload-pcap" )
530534
0 commit comments