From c1af6a0dada79888d3eb9c820163a6b34e900638 Mon Sep 17 00:00:00 2001 From: Joe Guo Date: Thu, 10 May 2018 17:04:50 +1200 Subject: [PATCH] traffic: improve add_short_packet by avoiding str.split Avoid str.split, which will repeat for each packet. Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- python/samba/emulate/traffic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index 95ab3c9d380..08a0fa32278 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -794,12 +794,12 @@ class Conversation(object): if p.is_really_a_packet(): self.packets.append(p) - def add_short_packet(self, timestamp, p, extra, client=True): + def add_short_packet(self, timestamp, protocol, opcode, extra, + client=True): """Create a packet from a timestamp, and 'protocol:opcode' pair, and a (possibly empty) list of extra data. If client is True, assume this packet is from the client to the server. """ - protocol, opcode = p.split(':', 1) src, dest = self.guess_client_server() if not client: src, dest = dest, src @@ -1220,7 +1220,7 @@ class TrafficModel(object): timestamp += wait if hard_stop is not None and timestamp > hard_stop: break - c.add_short_packet(timestamp, p, extra) + c.add_short_packet(timestamp, protocol, opcode, extra) key = key[1:] + (p,)