~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/medium.py

  • Committer: Aaron Bentley
  • Date: 2008-02-24 16:42:13 UTC
  • mfrom: (3234 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3235.
  • Revision ID: aaron@aaronbentley.com-20080224164213-eza1lzru5bwuwmmj
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
358
358
            new_char = self.read_bytes(1)
359
359
            line += new_char
360
360
            if new_char == '':
361
 
                raise errors.SmartProtocolError(
362
 
                    'unexpected end of file reading from server')
 
361
                # end of file encountered reading from server
 
362
                raise errors.ConnectionReset(
 
363
                    "please check connectivity and permissions",
 
364
                    "(and try -Dhpss if further diagnosis is required)")
363
365
        return line
364
366
 
365
367
 
384
386
 
385
387
    def __init__(self):
386
388
        self._current_request = None
 
389
        # Be optimistic: we assume the remote end can accept new remote
 
390
        # requests until we get an error saying otherwise.  (1.2 adds some
 
391
        # requests that send bodies, which confuses older servers.)
 
392
        self._remote_is_at_least_1_2 = True
387
393
 
388
394
    def accept_bytes(self, bytes):
389
395
        self._accept_bytes(bytes)
545
551
            port = BZR_DEFAULT_PORT
546
552
        else:
547
553
            port = int(self._port)
548
 
        result = self._socket.connect_ex((self._host, port))
549
 
        if result:
 
554
        try:
 
555
            self._socket.connect((self._host, port))
 
556
        except socket.error, err:
 
557
            # socket errors either have a (string) or (errno, string) as their
 
558
            # args.
 
559
            if type(err.args) is str:
 
560
                err_msg = err.args
 
561
            else:
 
562
                err_msg = err.args[1]
550
563
            raise errors.ConnectionError("failed to connect to %s:%d: %s" %
551
 
                    (self._host, port, os.strerror(result)))
 
564
                    (self._host, port, err_msg))
552
565
        self._connected = True
553
566
 
554
567
    def _flush(self):