diff options
author | Guido van Rossum <guido@python.org> | 2000-09-01 19:25:51 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-09-01 19:25:51 +0000 |
commit | 8d691c842289cf4453f282637765f07113a7cc17 (patch) | |
tree | 3a7819d53d7578cf728d3bcfecba7daebb6981db /Lib/dos-8x3/socketse.py | |
parent | 29201d490511b2af863e07fdf5cb247fc9117c2f (diff) | |
download | cpython-git-8d691c842289cf4453f282637765f07113a7cc17.tar.gz |
The usual
Diffstat (limited to 'Lib/dos-8x3/socketse.py')
-rwxr-xr-x | Lib/dos-8x3/socketse.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/dos-8x3/socketse.py b/Lib/dos-8x3/socketse.py index 5562fb0ef4..a263f8ebb1 100755 --- a/Lib/dos-8x3/socketse.py +++ b/Lib/dos-8x3/socketse.py @@ -412,10 +412,20 @@ class StreamRequestHandler(BaseRequestHandler): """Define self.rfile and self.wfile for stream sockets.""" + # Default buffer sizes for rfile, wfile. + # We default rfile to buffered because otherwise it could be + # really slow for large data (a getc() call per byte); we make + # wfile unbuffered because (a) often after a write() we want to + # read and we need to flush the line; (b) big writes to unbuffered + # files are typically optimized by stdio even when big reads + # aren't. + rbufsize = -1 + wbufsize = 0 + def setup(self): self.connection = self.request - self.rfile = self.connection.makefile('rb', 0) - self.wfile = self.connection.makefile('wb', 0) + self.rfile = self.connection.makefile('rb', self.rbufsize) + self.wfile = self.connection.makefile('wb', self.wbufsize) def finish(self): self.wfile.flush() |