def _processReceivedEnvelope(self, envelope):
        if not isinstance(envelope.message, ForwardMessage):
            self._incomingEnvelopes.append(envelope)
            return
        if envelope.message.fwdTo == self.myAddress:
            self._incomingEnvelopes.append(ReceiveEnvelope(envelope.message.fwdFrom,
                                                           envelope.message.fwdMessage))
            return
        # The ForwardMessage has not reached the final destination, so
        # update and target it at the next one.
        if len(envelope.message.fwdTargets) < 1 and envelope.message.fwdTo != self.myAddress:
            thesplog('Incorrectly received ForwardMessage destined for %s at %s via %s: %s',
                     envelope.message.fwdTo, self.myAddress,
                     list(map(str, envelope.message.fwdTargets)),
                     envelope.message.fwdMessage,
                     level=logging.ERROR)
            return  # discard  (TBD: send back as Poison? DeadLetter? Routing failure)
        nextTgt = envelope.message.fwdTargets[0]
        envelope.message.fwdTargets = envelope.message.fwdTargets[1:]
        self.scheduleTransmit(getattr(self, '_addressMgr', None),
                              TransmitIntent(nextTgt, envelope.message))
dataset/ETHPy150Open godaddy/Thespian/thespian/system/transport/TCPTransport.py/TCPTransport._processReceivedEnvelope/original