(self, data)
| 247 | return flushed |
| 248 | |
| 249 | def write(self, data): |
| 250 | self._bd.add(data) |
| 251 | |
| 252 | flushed = True |
| 253 | while flushed and self._bd.byteSz > PIPE_BUF_BYTES: |
| 254 | # Flush down to a small amount of buffered bytes as to |
| 255 | # avoid memory-copy intensive defragmentations. |
| 256 | # |
| 257 | # The tradeoff being made here is the price of a syscall |
| 258 | # (where larger buffers are better) vs. the price of |
| 259 | # copying some memory. |
| 260 | flushed = self._partial_flush(65535) |
| 261 | |
| 262 | def flush(self): |
| 263 | while self._bd.byteSz > 0: |