def read(self):
        try:
            bytes = self.sock.recv(self.max_size)
        except:
            self.torrent.kill_peer(self)
            return
        '''
        Chain of events:
            - process_input
            - check save_state and read length, id, and message accordingly
                - if we have a piece (really a block), we piece.save it out
                  inside call to ppiece
                    - If we've completed a piece we:
                        - Tell the switchboard to write it out
                        - init a new piece
        '''
        if len(bytes) == 0:
            print 'Got 0 bytes from fileno {}.'.format(self.fileno())
            self.torrent.kill_peer(self)
        self.process_input(bytes)
def read ( self ) : try : bytes = self . sock . recv ( self . max_size ) except : self . torrent . kill_peer ( self ) return '''
        Chain of events:
            - process_input
            - check save_state and read length, id, and message accordingly
                - if we have a piece (really a block), we piece.save it out
                  inside call to ppiece
                    - If we've completed a piece we:
                        - Tell the switchboard to write it out
                        - init a new piece
        ''' if len ( bytes ) == 0 : print 'Got 0 bytes from fileno {}.' . format ( self . fileno ( ) ) self . torrent . kill_peer ( self ) self . process_input ( bytes )
Chain of events:
            - process_input
            - check save_state and read length, id, and message accordingly
                - if we have a piece (really a block), we piece.save it out
                  inside call to ppiece
                    - If we've completed a piece we:
                        - Tell the switchboard to write it out
                        - init a new piece