Skip to content

Commit

Permalink
fix issue benoitc#229, put the rigt order for fdout and fdin.
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Jul 6, 2011
1 parent 7e9f8b5 commit 4c2267b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gunicorn/http/_sendfile.py
Expand Up @@ -18,7 +18,7 @@
SUPPORTED_PLATFORMS = (
'darwin',
'freebsd',
'dragonfly'
'dragonfly',
'linux2')

if sys.version_info < (2, 6) or \
Expand All @@ -35,6 +35,7 @@ def sendfile(fdout, fdin, offset, nbytes):
ctypes.c_int]
_nbytes = ctypes.c_uint64(nbytes)
result = _sendfile(fdin, fdout, offset, _nbytes, None, 0)

if result == -1:
e = ctypes.get_errno()
if e == errno.EAGAIN and _nbytes.value:
Expand Down
4 changes: 2 additions & 2 deletions gunicorn/http/wsgi.py
Expand Up @@ -270,9 +270,9 @@ def sendfile_all(self, fileno, sockno, offset, nbytes):
nbytes -= BLKSIZE
else:
sent = 0
sent += sendfile(fileno, sockno, offset+sent, nbytes-sent)
sent += sendfile(sockno, fileno, offset+sent, nbytes-sent)
while sent != nbytes:
sent += sendfile(fileno, sockno, offset+sent, nbytes-sent)
sent += sendfile(sockno, fileno, offset+sent, nbytes-sent)

def write_file(self, respiter):
if sendfile is not None and \
Expand Down

0 comments on commit 4c2267b

Please sign in to comment.