Wykres commitów

385 Commity (6b5cccaefa165ff94f06ba7d8ed0bae5c93f951c)

Autor SHA1 Wiadomość Data
Paul Sokolovsky 6b5cccaefa uasyncio.core: Release 0.8. 2014-11-04 02:55:21 +02:00
Paul Sokolovsky acbc5e462f uasyncio.core: Implement EventLoop.create_task(), new method in Python 3.4.2.
This method allows to schedule a coroutine in a loop without confusing globals
like async() or Task().
2014-11-04 02:52:31 +02:00
Paul Sokolovsky e9c7fa43f4 uasyncio: Set EpollEventLoop in a new way after .core refactor. 2014-11-04 02:52:31 +02:00
Paul Sokolovsky 9bb4f6b3b1 uasyncio.core: Implement async() and Task() for CPython compatibility. 2014-11-04 02:52:31 +02:00
Paul Sokolovsky 0a529adfdc uasyncio: Use EPOLLONESHOT flag for add_reader/writer().
When we issue IORead/IOWrite syscall, we want get back notification just for
that call. But if we add fd to epoll, it will trigger continuously when the
condition is met. For example, a socket with empty write buffer will always
signal EPOLLOUT, regardless if we want to write to it now or not. This will
lead to situation when our coro will be woken up on such socket on *any*
syscall, and this syscall will get completely different socket as result (
or if syscall doesn't return socket - completely different result value).

So, to get semantics right, we need to make sure that for each IORead/IOWrite,
we get notified only once, and further events on socket are ignored until
we ask for them again. This is exactly what EPOLLONESHOT flag does.

The other alternative is to remove fd from epoll after each IORead/IOWrite,
but apparently EPOLLONESHOT is more performant way.

Yet another alternarnative would be to use edge-triggered mode of epoll,
but it has own peculiarities, like, after each event, client must make sure
that it is handled completely and reset, otherwise it may not trigger again,
even if there's unprocessed data. For example, if EPOLLIN|EPOLLET is used,
client must make sure that it reads all data available, until read() returns
EAGAIN. If it reads say just 10 bytes, then next time event simply won't
trigger (because it's edge event, which triggers on change like "no data" -
"data"; if we didn't read all data, the situation is "data" - "data", there's
no change in condition, and event is not triggered). Surely, that's not what
we want (at least not without restructuring how StreamReader works).

So, EPOLLONESHOT is the most obvious, and easiest to reason way to get needed
semantics.
2014-11-03 00:41:00 +02:00
Paul Sokolovsky 2a26ee80b7 uasyncio: Add checks that IOWrite() syscall return us socket we expect.
One check is commented by default to not hurt performance.
2014-11-03 00:40:52 +02:00
Paul Sokolovsky 89f3b75b72 select: Add defines for EPOLLONESHOT & EPOLLET. 2014-11-03 00:40:33 +02:00
Paul Sokolovsky 610aa65cef uasyncio: Add StreamReader.close() method. 2014-10-29 00:55:10 +02:00
Paul Sokolovsky e8b99addbd uasyncio: Ignore ENOENT on remove_writer().
StreamWriter.awrite() first tries to write to an fd, and if that succeeds,
yield IOWrite may never be called for that fd, and it will never be added
to poller. So, ignore such error.
2014-10-27 00:30:40 +02:00
Paul Sokolovsky 0fcb1daa81 uasyncio: Log only if __debug__==True (i.e. no optimization). 2014-10-26 00:20:53 +03:00
Paul Sokolovsky cbaf0d3b57 uasyncio.core: Log only if __debug__==True (i.e. no optimization). 2014-10-26 00:20:45 +03:00
Paul Sokolovsky b684b448d1 test.pystone: Add pristine from Python-3.3.3 tarball. 2014-10-25 22:19:01 +03:00
Paul Sokolovsky 943fbb6efc errno: Add ECONNRESET. 2014-10-25 00:07:26 +03:00
Damien George 96bb130bb0 errno: Add ETIMEDOUT error (used by stmhal port). 2014-10-24 01:17:00 +03:00
Damien George 0bb2f38aaf uasyncio: Use uheapq instead of heapq.
Conflicts:
	uasyncio/uasyncio/__init__.py
2014-10-24 01:16:15 +03:00
Paul Sokolovsky 4a884ef849 uasyncio: Split off uasyncio.core dist module. 2014-10-24 01:00:53 +03:00
Paul Sokolovsky 2b582fd934 uasyncio: Cleanup module imports after split up. 2014-10-24 00:32:32 +03:00
Paul Sokolovsky b2130c84ce uasyncio: Split into "core" and "extended" modules. 2014-10-24 00:24:13 +03:00
Paul Sokolovsky a295825300 uasyncio: Convert to package. 2014-10-24 00:04:37 +03:00
Paul Sokolovsky 35f4720962 uasyncio: test_http_client.py: Use run_until_complete(). 2014-10-24 00:03:27 +03:00
Paul Sokolovsky 1256840278 uasyncio: Release 0.6.2. 2014-10-21 01:31:59 +03:00
Paul Sokolovsky a776b5086e uasyncio: Add __repr__() for StreamReader/StreamWriter. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 0a20a84f61 uasyncio: Implement run_until_complete(). 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 4d0d71f974 uasyncio: Update for rename microsocket -> usocket. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 8e97b6972a uasyncio: Rename asyncio_micro to uasyncio. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 545a033933 asyncio_micro: awrite(): More logging and checks. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky abd8b1646a asyncio_micro: Add metadata. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky eff1250e3b asyncio_micro: Optimize size of SysCall objects.
We have to have type header for any object, so use type to "store"
information about syscall type (my initial idea was to have single
syscall class and dispatch on its attribute, that would save memory
on having bunch of classes, but would increase size of each syscall
object).
2014-10-21 01:31:58 +03:00
Paul Sokolovsky 06c8c6ce8f asyncio_micro: Move handle() method to SysCall base class. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 6115b451ea asyncio_micro: Clean up logging. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 4af1cf5a30 asyncio_micro: Support just plain "yield" for cooperative control yield. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky d0d2810b0c asyncio_micro: Rename StreamWriter.write() to awrite().
This method has different semantics than original asyncio, so rename to avoid
confusion. Original asyncio's is not a coroutine, while ours is.
2014-10-21 01:31:58 +03:00
Paul Sokolovsky 9c3a3cd5ed asyncio_micro: Add basic HTTP server example. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 15cc7aa7b7 asyncio_micro: Implement proper write() handling.
TODO: Test!
2014-10-21 01:31:58 +03:00
Paul Sokolovsky 6e61c501ac asyncio_micro: Support readall semantics and handle non-blocking read() well.
Non-blocking read()/write() may return None if there's no data, and that's
not EOF.
2014-10-21 01:31:58 +03:00
Paul Sokolovsky fe85cca848 asyncio_micro: Add support for starting a coroutine concurrently.
Just yield it as a value. Also, improve logging/error reporting.
2014-10-21 01:31:58 +03:00
Paul Sokolovsky bfaf6b8d19 asyncio_micro: IODone syscall should return to coroutine. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky acd25d05fc asyncio_micro: Implement start_server(). 2014-10-21 01:31:58 +03:00
Paul Sokolovsky b86919a6ff asyncio_micro: StreamReader, StreamWriter: add more methods. 2014-10-21 01:31:58 +03:00
Paul Sokolovsky 1c647189f1 asyncio_micro: Work around stupid Python closures.
Which don't close variables, just variable references.
2014-10-21 01:31:58 +03:00
Paul Sokolovsky 0b5ca354e2 asyncio_micro: Rename from asyncio.
As this is not compliant with asyncio API, can't be called asyncio, and
"micro" is just good moniker for what it's intended to be.
2014-10-21 01:31:58 +03:00
Paul Sokolovsky 4071bb5e74 asyncio: Clean up code a bit. 2014-10-21 01:31:57 +03:00
Paul Sokolovsky bce6c1cadf asyncio: Remove polling sleep implementation, it belongs in async_slow. 2014-10-21 01:31:57 +03:00
Paul Sokolovsky 2feacf5a50 asyncio_slow: Add example of wait() from docs. 2014-10-21 01:31:57 +03:00
Paul Sokolovsky 3949d4f8b6 asyncio_slow: Fix wait: again, should not schedule anything itself. 2014-10-21 01:31:57 +03:00
Paul Sokolovsky 0b1d9a0493 asyncio_slow: Add Future examples from docs. 2014-10-21 01:31:57 +03:00
Paul Sokolovsky 30a0586732 asyncio_slow: Implement loop.stop(). 2014-10-21 01:31:57 +03:00
Paul Sokolovsky 8d1ae59f3a asyncio_slow: run_until_complete() should not schedule anyhing.
Everything should be scheduled either already, or async() does this.
2014-10-21 01:31:57 +03:00
Paul Sokolovsky 4a3a4927c4 asyncio_slow: Add example on chaining coros using "yield from" from docs. 2014-10-21 01:31:57 +03:00
Paul Sokolovsky ce54259e95 asyncio_slow: Add example for scheduling coro using Task. 2014-10-21 01:31:57 +03:00