~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/medium.py

  • Committer: Martin Pool
  • Date: 2009-09-01 07:47:36 UTC
  • mto: (4634.6.16 2.0)
  • mto: This revision was merged to the branch mainline in revision 4671.
  • Revision ID: mbp@sourcefrog.net-20090901074736-zt849t2gx36f8hz8
Further until_no_eintr cover is smart.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
291
291
    def terminate_due_to_error(self):
292
292
        # TODO: This should log to a server log file, but no such thing
293
293
        # exists yet.  Andrew Bennetts 2006-09-29.
294
 
        self.socket.close()
 
294
        osutils.until_no_eintr(self.socket.close)
295
295
        self.finished = True
296
296
 
297
297
    def _write_out(self, bytes):
326
326
            bytes_to_read = protocol.next_read_size()
327
327
            if bytes_to_read == 0:
328
328
                # Finished serving this request.
329
 
                self._out.flush()
 
329
                osutils.until_no_eintr(self._out.flush)
330
330
                return
331
331
            bytes = self.read_bytes(bytes_to_read)
332
332
            if bytes == '':
333
333
                # Connection has been closed.
334
334
                self.finished = True
335
 
                self._out.flush()
 
335
                osutils.until_no_eintr(self._out.flush)
336
336
                return
337
337
            protocol.accept_bytes(bytes)
338
338
 
342
342
    def terminate_due_to_error(self):
343
343
        # TODO: This should log to a server log file, but no such thing
344
344
        # exists yet.  Andrew Bennetts 2006-09-29.
345
 
        self._out.close()
 
345
        osutils.until_no_eintr(self._out.close)
346
346
        self.finished = True
347
347
 
348
348
    def _write_out(self, bytes):
349
 
        self._out.write(bytes)
 
349
        osutils.until_no_eintr(self._out.write, bytes)
350
350
 
351
351
 
352
352
class SmartClientMediumRequest(object):
712
712
 
713
713
    def _accept_bytes(self, bytes):
714
714
        """See SmartClientStreamMedium.accept_bytes."""
715
 
        self._writeable_pipe.write(bytes)
 
715
        osutils.until_no_eintr(self._writeable_pipe.write, bytes)
716
716
        self._report_activity(len(bytes), 'write')
717
717
 
718
718
    def _flush(self):
719
719
        """See SmartClientStreamMedium._flush()."""
720
 
        self._writeable_pipe.flush()
 
720
        osutils.until_no_eintr(self._writeable_pipe.flush)
721
721
 
722
722
    def _read_bytes(self, count):
723
723
        """See SmartClientStreamMedium._read_bytes."""
765
765
    def _accept_bytes(self, bytes):
766
766
        """See SmartClientStreamMedium.accept_bytes."""
767
767
        self._ensure_connection()
768
 
        self._write_to.write(bytes)
 
768
        osutils.until_no_eintr(self._write_to.write, bytes)
769
769
        self._report_activity(len(bytes), 'write')
770
770
 
771
771
    def disconnect(self):
772
772
        """See SmartClientMedium.disconnect()."""
773
773
        if not self._connected:
774
774
            return
775
 
        self._read_from.close()
776
 
        self._write_to.close()
 
775
        osutils.until_no_eintr(self._read_from.close)
 
776
        osutils.until_no_eintr(self._write_to.close)
777
777
        self._ssh_connection.close()
778
778
        self._connected = False
779
779
 
832
832
        """See SmartClientMedium.disconnect()."""
833
833
        if not self._connected:
834
834
            return
835
 
        self._socket.close()
 
835
        osutils.until_no_eintr(self._socket.close)
836
836
        self._socket = None
837
837
        self._connected = False
838
838