def write(self, bytes): try: return self.s.send(bytes) except OSError, why: if why.errno == errno.EBADF: raise_oserror(errno.EPIPE) else: raise
if len(chunk)==0: raise EOFError count -= len(chunk) result.append(chunk) return ''.join(result) def write(self, bytes): try: return self.s.send(bytes) except OSError, why: if why.errno == errno.EBADF: raise_oserror(errno.EPIPE) else: raise except coro.ClosedError: raise_oserror(errno.EPIPE) def read_line(self): # XXX: This should be made more efficient with buffering. # However, the complexity and overhead of adding buffering just # to support reading the line at the beginning of the protocol # negotiation seems kinda silly. result = [] while 1: try: it = self.s.recv(1) except OSError, why: if why.errno == errno.EBADF: raise EOFError else: raise
if len(chunk) == 0: raise EOFError count -= len(chunk) result.append(chunk) return ''.join(result) def write(self, bytes): try: return self.s.send(bytes) except OSError, why: if why.errno == errno.EBADF: raise_oserror(errno.EPIPE) else: raise except coro.ClosedError: raise_oserror(errno.EPIPE) def read_line(self): # XXX: This should be made more efficient with buffering. # However, the complexity and overhead of adding buffering just # to support reading the line at the beginning of the protocol # negotiation seems kinda silly. result = [] while 1: try: it = self.s.recv(1) except OSError, why: if why.errno == errno.EBADF: raise EOFError else: raise