Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  Sending data faster than a socket could transmit it wasn't handled
  correctly.
  • Loading branch information
Jim Fulton committed Apr 6, 2012
1 parent 940cb98 commit 2445c42
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 9 additions & 0 deletions README.txt
Expand Up @@ -19,6 +19,15 @@ To learn more, see http://packages.python.org/zc.ngi/
Changes
*******

====================
2.0.1 (2012-04-06)
====================

Bugs Fixed

- Sending data faster than a socket could transmit it wasn't handled
correctly.

====================
2.0.0 (2011-12-10)
====================
Expand Down
2 changes: 1 addition & 1 deletion src/zc/ngi/async.py
Expand Up @@ -397,7 +397,7 @@ def handle_write_event(self):
return # can't send any more
finally:
if nsend:
self.output[0:0] = tosend
output[0:0] = tosend


def handle_close(self, reason='end of input'):
Expand Down
14 changes: 11 additions & 3 deletions src/zc/ngi/async.test
Expand Up @@ -47,15 +47,23 @@ shouldn't get any output.
>>> _ = [thread.start() for thread in threads]
>>> _ = [thread.join() for thread in threads]

Large input
===========

>>> import zc.ngi.blocking
>>> output, input = zc.ngi.blocking.open(addr, zc.ngi.async.connect,
... timeout=1.0)

>>> output.write('hello world\n' * 20000 + '\0')
>>> input.readline(timeout=1.0)
'20000 40000 240000\n'

Iterable input
==============

We can pass data to the server using an iterator. To illustrate this,
we'll use the blocking interface:

>>> import zc.ngi.blocking
>>> output, input = zc.ngi.blocking.open(addr, zc.ngi.async.connect,
... timeout=1.0)
>>> def hello(name):
... yield "hello\n"
... yield name
Expand Down

0 comments on commit 2445c42

Please sign in to comment.