mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
shuffle the registration check #177
This commit is contained in:
parent
d5fa8768d5
commit
8b1d3650a7
|
@ -546,11 +546,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
|
||||
return
|
||||
|
||||
# check the BBMD registration status, we may not be registered
|
||||
if self.registrationStatus != 0:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
|
||||
return
|
||||
|
||||
if isinstance(pdu, OriginalUnicastNPDU):
|
||||
# build a vanilla PDU
|
||||
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
|
||||
|
@ -559,6 +554,11 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
self.response(xpdu)
|
||||
|
||||
elif isinstance(pdu, ForwardedNPDU):
|
||||
# check the BBMD registration status, we may not be registered
|
||||
if self.registrationStatus != 0:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
|
||||
return
|
||||
|
||||
# make sure the forwarded PDU from the bbmd
|
||||
if pdu.pduSource != self.bbmdAddress:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, not from the BBMD")
|
||||
|
@ -626,6 +626,9 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
# send it downstream
|
||||
self.request(xpdu)
|
||||
|
||||
elif isinstance(pdu, OriginalBroadcastNPDU):
|
||||
if _debug: BIPForeign._debug(" - packet dropped")
|
||||
|
||||
else:
|
||||
BIPForeign._warning("invalid pdu type: %s", type(pdu))
|
||||
|
||||
|
|
|
@ -542,11 +542,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
|
||||
return
|
||||
|
||||
# check the BBMD registration status, we may not be registered
|
||||
if self.registrationStatus != 0:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
|
||||
return
|
||||
|
||||
if isinstance(pdu, OriginalUnicastNPDU):
|
||||
# build a vanilla PDU
|
||||
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
|
||||
|
@ -555,6 +550,11 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
self.response(xpdu)
|
||||
|
||||
elif isinstance(pdu, ForwardedNPDU):
|
||||
# check the BBMD registration status, we may not be registered
|
||||
if self.registrationStatus != 0:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
|
||||
return
|
||||
|
||||
# make sure the forwarded PDU from the bbmd
|
||||
if pdu.pduSource != self.bbmdAddress:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, not from the BBMD")
|
||||
|
@ -622,6 +622,9 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
# send it downstream
|
||||
self.request(xpdu)
|
||||
|
||||
elif isinstance(pdu, OriginalBroadcastNPDU):
|
||||
if _debug: BIPForeign._debug(" - packet dropped")
|
||||
|
||||
else:
|
||||
BIPForeign._warning("invalid pdu type: %s", type(pdu))
|
||||
|
||||
|
|
|
@ -541,11 +541,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
|
||||
return
|
||||
|
||||
# check the BBMD registration status, we may not be registered
|
||||
if self.registrationStatus != 0:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
|
||||
return
|
||||
|
||||
if isinstance(pdu, OriginalUnicastNPDU):
|
||||
# build a vanilla PDU
|
||||
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
|
||||
|
@ -554,6 +549,11 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
self.response(xpdu)
|
||||
|
||||
elif isinstance(pdu, ForwardedNPDU):
|
||||
# check the BBMD registration status, we may not be registered
|
||||
if self.registrationStatus != 0:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
|
||||
return
|
||||
|
||||
# make sure the forwarded PDU from the bbmd
|
||||
if pdu.pduSource != self.bbmdAddress:
|
||||
if _debug: BIPForeign._debug(" - packet dropped, not from the BBMD")
|
||||
|
@ -621,6 +621,9 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
|
|||
# send it downstream
|
||||
self.request(xpdu)
|
||||
|
||||
elif isinstance(pdu, OriginalBroadcastNPDU):
|
||||
if _debug: BIPForeign._debug(" - packet dropped")
|
||||
|
||||
else:
|
||||
BIPForeign._warning("invalid pdu type: %s", type(pdu))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user