Commit d7b124b1 authored by Florent Fourcot's avatar Florent Fourcot

conntrack: add some __slots__ attribute to reduce memory usage

parent c748a223
......@@ -9,6 +9,9 @@ from pyroute2.netlink.nfnetlink.nfctsocket import NFCTSocket
class NFCTATcpProtoInfo(object):
__slots__ = ('state', 'wscale_orig', 'wscale_reply', 'flags_orig',
'flags_reply')
def __init__(self, state, wscale_orig=None, wscale_reply=None,
flags_orig=None, flags_reply=None):
self.state = state
......@@ -49,6 +52,9 @@ class NFCTATcpProtoInfo(object):
class ConntrackEntry(object):
__slots__ = ('tuple_orig', 'tuple_reply', 'status', 'timeout',
'protoinfo', 'mark', 'id', 'use')
def __init__(self, family, tuple_orig, tuple_reply, cta_status,
cta_timeout, cta_protoinfo, cta_mark, cta_id, cta_use):
self.tuple_orig = NFCTAttrTuple.from_netlink(family, tuple_orig)
......
......@@ -367,6 +367,11 @@ class NFCTAttr(object):
class NFCTAttrTuple(NFCTAttr):
__slots__ = ('saddr', 'daddr', 'proto', 'sport', 'dport',
'icmp_id', 'icmp_type', 'family', '_attr_ip',
'_attr_icmp')
def __init__(self, family=socket.AF_INET,
saddr=None, daddr=None, proto=None, sport=None, dport=None,
icmp_id=None, icmp_type=None, icmp_code=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment