| 238 | return self.uwrite(buf) |
| 239 | |
| 240 | def uread(self): |
| 241 | if self.connect_to: |
| 242 | return None # still connecting |
| 243 | if self.shut_read: |
| 244 | return |
| 245 | self.rsock.setblocking(False) |
| 246 | try: |
| 247 | return _nb_clean(self.rsock.recv, 65536) |
| 248 | except (OSError, socket.error): |
| 249 | _, e = sys.exc_info()[:2] |
| 250 | if e.errno == errno.EPIPE: |
| 251 | debug1('%r: uread: got EPIPE' % self) |
| 252 | self.noread() |
| 253 | return b('') # treat broken pipe as EOF |
| 254 | else: |
| 255 | self.seterr('uread: %s' % e) |
| 256 | return b('') # unexpected error... we'll call it EOF |
| 257 | |
| 258 | def fill(self): |
| 259 | if self.buf: |