~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: Andrew Bennetts
  • Date: 2008-02-28 08:15:12 UTC
  • mto: (3245.4.1 Version 3 implementation.)
  • mto: This revision was merged to the branch mainline in revision 3428.
  • Revision ID: andrew.bennetts@canonical.com-20080228081512-66hmd3gy8nvtetue
Fix more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
260
260
        self.finished_reading = False
261
261
        self.unused_data = ''
262
262
        self.bytes_left = None
 
263
        self._number_needed_bytes = None
263
264
 
264
265
    def accept_bytes(self, bytes):
265
266
        """Decode as much of bytes as possible.
272
273
        """
273
274
        # accept_bytes is allowed to change the state
274
275
        current_state = self.state_accept
 
276
        self._number_needed_bytes = None
275
277
        try:
276
278
            pr('invoking state_accept %s' %
277
279
                    (self.state_accept.im_func.__name__[len('_state_accept_'):],))
281
283
                pr('invoking state_accept %s' %
282
284
                        (self.state_accept.im_func.__name__[len('_state_accept_'):],))
283
285
                self.state_accept('')
284
 
        except _NeedMoreBytes:
285
 
            raise
286
 
            #pass
 
286
        except _NeedMoreBytes, e:
 
287
            #print '(need more bytes: %r)' % e.count
 
288
            self._number_needed_bytes = e.count
287
289
 
288
290
 
289
291
class ChunkedBodyDecoder(_StatefulDecoder):
725
727
        self._number_needed_bytes = None
726
728
        try:
727
729
            _StatefulDecoder.accept_bytes(self, bytes)
728
 
        except _NeedMoreBytes, e:
729
 
            #print '(need more bytes: %r)' % e.count
730
 
            self._number_needed_bytes = e.count
731
730
        except KeyboardInterrupt:
732
731
            raise
733
732
        except Exception, exception: