/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Jelmer Vernooij
  • Date: 2009-03-12 14:02:53 UTC
  • mfrom: (4135 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4137.
  • Revision ID: jelmer@samba.org-20090312140253-bmldbzlmsitfdrzf
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1623
1623
    return b
1624
1624
 
1625
1625
 
1626
 
def send_all(socket, bytes):
 
1626
def send_all(socket, bytes, report_activity=None):
1627
1627
    """Send all bytes on a socket.
1628
1628
 
1629
1629
    Regular socket.sendall() can give socket error 10053 on Windows.  This
1630
1630
    implementation sends no more than 64k at a time, which avoids this problem.
 
1631
 
 
1632
    :param report_activity: Call this as bytes are read, see
 
1633
        Transport._report_activity
1631
1634
    """
1632
1635
    chunk_size = 2**16
1633
1636
    for pos in xrange(0, len(bytes), chunk_size):
1634
 
        until_no_eintr(socket.sendall, bytes[pos:pos+chunk_size])
 
1637
        block = bytes[pos:pos+chunk_size]
 
1638
        if report_activity is not None:
 
1639
            report_activity(len(block), 'write')
 
1640
        until_no_eintr(socket.sendall, block)
1635
1641
 
1636
1642
 
1637
1643
def dereference_path(path):