Browse Source

Add some sanity checks to Packet.__add__()

pull/14/head
Richard Neumann 3 years ago
parent
commit
0e693c724b
  1. 9
      rcon/source/proto.py

9
rcon/source/proto.py

@ -91,6 +91,15 @@ class Packet(NamedTuple):
if other is None:
return self
if other.id != self.id:
raise ValueError('Can only add packages with same id.')
if other.type != self.type:
raise ValueError('Can only add packages of same type.')
if other.terminator != self.terminator:
raise ValueError('Can only add packages with same terminator.')
return Packet(
self.id,
self.type,

Loading…
Cancel
Save