~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2013-05-19 14:29:37 UTC
  • mfrom: (6437.63.9 2.5)
  • mto: (6437.63.10 2.5)
  • mto: This revision was merged to the branch mainline in revision 6575.
  • Revision ID: john@arbash-meinel.com-20130519142937-21ykz2n2y2f22za9
Merge in the actual 2.5 branch. It seems I failed before

Show diffs side-by-side

added added

removed removed

Lines of Context:
2064
2064
# data at once.
2065
2065
MAX_SOCKET_CHUNK = 64 * 1024
2066
2066
 
2067
 
_end_of_stream_errors = [errno.ECONNRESET]
 
2067
_end_of_stream_errors = [errno.ECONNRESET, errno.EPIPE, errno.EINVAL]
2068
2068
for _eno in ['WSAECONNRESET', 'WSAECONNABORTED']:
2069
2069
    _eno = getattr(errno, _eno, None)
2070
2070
    if _eno is not None:
2136
2136
    while sent_total < byte_count:
2137
2137
        try:
2138
2138
            sent = sock.send(buffer(bytes, sent_total, MAX_SOCKET_CHUNK))
2139
 
        except socket.error, e:
 
2139
        except (socket.error, IOError), e:
 
2140
            if e.args[0] in _end_of_stream_errors:
 
2141
                raise errors.ConnectionReset(
 
2142
                    "Error trying to write to socket", e)
2140
2143
            if e.args[0] != errno.EINTR:
2141
2144
                raise
2142
2145
        else:
 
2146
            if sent == 0:
 
2147
                raise errors.ConnectionReset('Sending to %s returned 0 bytes'
 
2148
                                             % (sock,))
2143
2149
            sent_total += sent
2144
 
            report_activity(sent, 'write')
 
2150
            if report_activity is not None:
 
2151
                report_activity(sent, 'write')
2145
2152
 
2146
2153
 
2147
2154
def connect_socket(address):