summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-05-10 17:04:50 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-05-12 02:09:29 +0200
commitc1af6a0dada79888d3eb9c820163a6b34e900638 (patch)
tree4541aeb53454d497c2414bd0019db070e6a7bc1b /python
parent5107e56aa089b51f8d00049b63b2c79ea9e495cc (diff)
downloadsamba-c1af6a0dada79888d3eb9c820163a6b34e900638.tar.gz
samba-c1af6a0dada79888d3eb9c820163a6b34e900638.tar.bz2
samba-c1af6a0dada79888d3eb9c820163a6b34e900638.zip
traffic: improve add_short_packet by avoiding str.split
Avoid str.split, which will repeat for each packet. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'python')
-rw-r--r--python/samba/emulate/traffic.py6
1 files 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,)