def handlePDU(self, pdu: DeviceRedirectionPDU, destination: DeviceRedirectionLayer): """ Handle the logic for a PDU and send the PDU to its destination. :param pdu: the PDU that was received :param destination: the destination layer """ dropPDU = False if isinstance(pdu, DeviceIORequestPDU) and destination is self.client: self.handleIORequest(pdu) elif isinstance(pdu, DeviceIOResponsePDU) and destination is self.server: dropPDU = (pdu.deviceID, pdu.completionID) in self.forgedRequests self.handleIOResponse(pdu) elif isinstance(pdu, DeviceListAnnounceRequest): self.handleDeviceListAnnounceRequest(pdu) elif isinstance(pdu, DeviceRedirectionPDU): if pdu.packetID == DeviceRedirectionPacketID.PAKID_CORE_USER_LOGGEDON: self.handleClientLogin() if not dropPDU: destination.sendPDU(pdu)
def handlePDU(self, pdu: DeviceRedirectionPDU, destination: DeviceRedirectionLayer): """ Handle the logic for a PDU and send the PDU to its destination. :param pdu: the PDU that was received :param destination: the destination layer """ if isinstance(pdu, DeviceIORequestPDU) and destination is self.client: self.handleIORequest(pdu) elif isinstance(pdu, DeviceIOResponsePDU) and destination is self.server: self.handleIOResponse(pdu) elif isinstance(pdu, DeviceListAnnounceRequest): self.handleDeviceListAnnounceRequest(pdu) destination.sendPDU(pdu)