~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

Merge serialize-transform into prepare-shelf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
688
688
            # Now that we've read some data, see if we can yield anything back
689
689
            while cur_offset_and_size in data_map:
690
690
                this_data = data_map.pop(cur_offset_and_size)
691
 
                yield cur_offset_and_size[0], this_data
692
 
                cur_offset_and_size = offset_stack.next()
 
691
                this_offset = cur_offset_and_size[0]
 
692
                try:
 
693
                    cur_offset_and_size = offset_stack.next()
 
694
                except StopIteration:
 
695
                    # Close the file handle as there will be no more data
 
696
                    # The handle would normally be cleaned up as this code goes
 
697
                    # out of scope, but as we are a generator, not all code
 
698
                    # will re-enter once we have consumed all the expected
 
699
                    # data. For example:
 
700
                    #   zip(range(len(requests)), readv(foo, requests))
 
701
                    # Will stop because the range is done, and not run the
 
702
                    # cleanup code for the readv().
 
703
                    fp.close()
 
704
                    cur_offset_and_size = None
 
705
                yield this_offset, this_data
693
706
 
694
707
    def _sort_expand_and_combine(self, offsets, upper_limit):
695
708
        """Helper for readv.