diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2018-10-19 16:46:05 +1300 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2019-01-08 23:55:32 +0100 |
commit | 158f172845f6b2cbe0b392cc23fde9bdd32960d4 (patch) | |
tree | 2f35fd95697df1e099c071ee0fc05697aa5c8fa6 /python | |
parent | 9da79b54fa4ec31d82b7d1a23568b576140a7e9b (diff) | |
download | samba-158f172845f6b2cbe0b392cc23fde9bdd32960d4.tar.gz |
traffic: use namedtuple for ConversationAccounts namespace class
Saving memory, which reduces fork overhead.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/emulate/traffic.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index d87a8c54ab4..eb5a3c6b2c0 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -27,7 +27,7 @@ import sys import signal import itertools -from collections import OrderedDict, Counter, defaultdict +from collections import OrderedDict, Counter, defaultdict, namedtuple from samba.emulate import traffic_packets from samba.samdb import SamDB import ldb @@ -1590,14 +1590,15 @@ def create_ou(ldb, instance_id): return ou -class ConversationAccounts(object): - """Details of the machine and user accounts associated with a conversation. - """ - def __init__(self, netbios_name, machinepass, username, userpass): - self.netbios_name = netbios_name - self.machinepass = machinepass - self.username = username - self.userpass = userpass +# ConversationAccounts holds details of the machine and user accounts +# associated with a conversation. +# +# We use a named tuple to reduce shared memory usage. +ConversationAccounts = namedtuple('ConversationAccounts', + ('netbios_name', + 'machinepass', + 'username', + 'userpass')) def generate_replay_accounts(ldb, instance_id, number, password): |