Commit 0151669a authored by oroulet's avatar oroulet Committed by oroulet

also fix selecting limits

parent c810a2b8
...@@ -29,12 +29,10 @@ class TransportLimits: ...@@ -29,12 +29,10 @@ class TransportLimits:
max_message_size: int = 100 * 1024 * 1024 # 100mb max_message_size: int = 100 * 1024 * 1024 # 100mb
@staticmethod @staticmethod
def _select_limit(hint: ua.UInt32, limit: int) -> ua.UInt32: def _select_limit(other: ua.UInt32, current_limit: int) -> ua.UInt32:
if limit <= 0: if current_limit <= 0 or other <= 0:
return hint return max(other, ua.UInt32(current_limit))
elif limit < hint: return min(other, ua.UInt32(current_limit))
return hint
return ua.UInt32(limit)
def is_msg_size_within_limit(self, sz: int) -> bool: def is_msg_size_within_limit(self, sz: int) -> bool:
if self.max_message_size == 0: if self.max_message_size == 0:
......
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