Beispiel #1
0
    def connection_ready(self, stream):
        if not stream.id in NEGOTIATE_SERVER_BITTORRENT.peers:
            raise RuntimeError("Unauthorized peer")

        #
        # Override the number of bytes using information passed
        # from the peer and regenerate the schedule so that we
        # actually transfer that number of bytes.
        #
        self.target_bytes = NEGOTIATE_SERVER_BITTORRENT.peers[stream.id]["target_bytes"]
        self.make_sched()

        PeerNeubot.connection_ready(self, stream)
Beispiel #2
0
    def connection_ready(self, stream):
        if not stream.id in AUTH_PEERS:
            raise RuntimeError("Unauthorized peer")

        # Not needed: peer.py already does that
        # stream.watchdog = 30

        #
        # Override the number of bytes using information passed
        # from the peer and regenerate the schedule so that we
        # actually transfer that number of bytes.
        #
        self.target_bytes = AUTH_PEERS[stream.id]["target_bytes"]
        self.make_sched()

        PeerNeubot.connection_ready(self, stream)