333 object.__getattribute__(self, '_logfp').write(msg) |
332 object.__getattribute__(self, '_logfp').write(msg) |
334 object.__getattribute__(self, '_logfp').write(b'\n') |
333 object.__getattribute__(self, '_logfp').write(b'\n') |
335 object.__getattribute__(self, '_logfp').flush() |
334 object.__getattribute__(self, '_logfp').flush() |
336 |
335 |
337 def _close(self): |
336 def _close(self): |
338 # Python 3 uses an io.BufferedIO instance. Python 2 uses some file |
337 # We wrap an io.BufferedIO instance. |
339 # object wrapper. |
338 orig = object.__getattribute__(self, '_orig') |
340 if pycompat.ispy3: |
339 |
341 orig = object.__getattribute__(self, '_orig') |
340 if hasattr(orig, 'raw'): |
342 |
341 orig.raw._sock.shutdown(socket.SHUT_RDWR) |
343 if hasattr(orig, 'raw'): |
342 else: |
344 orig.raw._sock.shutdown(socket.SHUT_RDWR) |
343 self.close() |
345 else: |
|
346 self.close() |
|
347 else: |
|
348 self._sock.shutdown(socket.SHUT_RDWR) |
|
349 |
344 |
350 def read(self, size=-1): |
345 def read(self, size=-1): |
351 cond = object.__getattribute__(self, '_cond') |
346 cond = object.__getattribute__(self, '_cond') |
352 return cond.forward_read(self, 'read', size) |
347 return cond.forward_read(self, 'read', size) |
353 |
348 |