Rev 3752: Fixed as per Andrew's review. in http://bazaar.launchpad.net/%7Ebzr/bzr/osx_tests_fix
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Oct 1 07:55:03 BST 2008
At http://bazaar.launchpad.net/%7Ebzr/bzr/osx_tests_fix
------------------------------------------------------------
revno: 3752
revision-id: v.ladeuil+lp at free.fr-20081001065456-11t2baisy3yyf6po
parent: v.ladeuil+lp at free.fr-20080930063313-qoc0otudltcy9idv
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: osx_tests_fix
timestamp: Wed 2008-10-01 08:54:56 +0200
message:
Fixed as per Andrew's review.
* bzrlib/smart/message.py:
(ConventionalResponseHandler._read_more): Revert previous change,
wrong layer.
* bzrlib/smart/medium.py:
(SmartTCPClientMedium._read_bytes): Catch socket connection reset.
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py 2008-09-19 10:12:18 +0000
+++ b/bzrlib/smart/medium.py 2008-10-01 06:54:56 +0000
@@ -24,6 +24,7 @@
bzrlib/transport/smart/__init__.py.
"""
+import errno
import os
import socket
import sys
@@ -784,7 +785,14 @@
raise errors.MediumNotConnected(self)
# We ignore the desired_count because on sockets it's more efficient to
# read large chunks (of _MAX_READ_SIZE bytes) at a time.
- return self._socket.recv(_MAX_READ_SIZE)
+ try:
+ return self._socket.recv(_MAX_READ_SIZE)
+ except socket.error, e:
+ if len(e.args) and e.args[0] == errno.ECONNRESET:
+ # Callers expect an empty string in that case
+ return ''
+ else:
+ raise
class SmartClientStreamMediumRequest(SmartClientMediumRequest):
=== modified file 'bzrlib/smart/message.py'
--- a/bzrlib/smart/message.py 2008-09-30 06:33:13 +0000
+++ b/bzrlib/smart/message.py 2008-10-01 06:54:56 +0000
@@ -16,8 +16,6 @@
import collections
from cStringIO import StringIO
-import errno
-import socket
from bzrlib import (
debug,
@@ -236,13 +234,7 @@
self.finished_reading = True
self._medium_request.finished_reading()
return
- try:
- bytes = self._medium_request.read_bytes(next_read_size)
- except socket.error, e:
- if len(e.args) and e.args[0] is errno.ECONNRESET:
- bytes = ''
- else:
- raise
+ bytes = self._medium_request.read_bytes(next_read_size)
if bytes == '':
# end of file encountered reading from server
if 'hpss' in debug.debug_flags:
More information about the bazaar-commits
mailing list