Revision 28f46c8d mininet/node.py

View differences:

mininet/node.py
116 116
        self.shell = None
117 117

  
118 118
    # Subshell I/O, commands and control
119
    def read( self, bytes=1024 ):
119
    def read( self, maxbytes=1024 ):
120 120
        """Buffered read from node, non-blocking.
121
           bytes: maximum number of bytes to return"""
121
           maxbytes: maximum number of bytes to return"""
122 122
        count = len( self.readbuf )
123
        if count < bytes:
124
            data = os.read( self.stdout.fileno(), bytes - count )
123
        if count < maxbytes:
124
            data = os.read( self.stdout.fileno(), maxbytes - count )
125 125
            self.readbuf += data
126
        if bytes >= len( self.readbuf ):
126
        if maxbytes >= len( self.readbuf ):
127 127
            result = self.readbuf
128 128
            self.readbuf = ''
129 129
        else:
130
            result = self.readbuf[ :bytes ]
131
            self.readbuf = self.readbuf[ bytes: ]
130
            result = self.readbuf[ :maxbytes ]
131
            self.readbuf = self.readbuf[ maxbytes: ]
132 132
        return result
133 133

  
134 134
    def readline( self ):

Also available in: Unified diff