~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-19 03:39:18 UTC
  • mfrom: (3118.2.2 sendall-limit)
  • Revision ID: pqm@pqm.ubuntu.com-20071219033918-4r7sd1wllfw5oyf2
(andrew) Fix #115781 by passing no more than 64k at a time to
        socket.sendall.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1407
1407
    return b
1408
1408
 
1409
1409
 
 
1410
def send_all(socket, bytes):
 
1411
    """Send all bytes on a socket.
 
1412
 
 
1413
    Regular socket.sendall() can give socket error 10053 on Windows.  This
 
1414
    implementation sends no more than 64k at a time, which avoids this problem.
 
1415
    """
 
1416
    chunk_size = 2**16
 
1417
    for pos in xrange(0, len(bytes), chunk_size):
 
1418
        socket.sendall(bytes[pos:pos+chunk_size])
 
1419
 
 
1420
 
1410
1421
def dereference_path(path):
1411
1422
    """Determine the real path to a file.
1412
1423