def transfer (self, packet): def rx (): packet.mark(self.dstEnt) #FIXME: do this somewhere more convenient self.dstEnt.handle_rx(packet, self.dstPort) world.doLater(self.latency, rx) events.packet(self.srcEnt.name, self.dstEnt.name, packet, self.latency)
def transfer(self, packet): if random.random() >= self.drop: super(UnreliableCable, self).transfer(packet) else: events.packet(self.srcEnt.name, self.dstEnt.name, packet, self.latency, drop=True)
def transfer (self, packet): if random.random() >= self.drop: super(UnreliableCable, self).transfer(packet) else: events.packet(self.srcEnt.name, self.dstEnt.name, packet, self.latency, drop=True)