added check for connected when triggered method is called. can't trigger
[urisagit/Stem.git] / Design / asyncio_notes
CommitLineData
4536f655 1 Stem::AsyncIO Design Notes
2
3The Stem::AsyncIO module provides a buffered I/O interface to sockets
4and process handles. It is used by a variety of modules such as
5Stem::Proc, Stem::SockMsg, Stem::Portal::Stream to do the common
6function of doing their buffered I/O.
7
8The constructor takes an owner object and up to 3 handles: input, output
9and stderr (for processes). The input and stderr handles are monitored
10with read events and when data is available, it is read and a callback
11is made to the owner object with the data as its argument.
12
13The write handle is fully buffered and the module provides non-blocking
14asynchronous output to it. Data to be sent to the handle is passed in
15with the write method. If there is any output data buffered, a write
16event monitors the handle and triggers a callback when data can be
17written to it. The callback writes as much data as possible to the write
18handle.
19
20If the read or stderr handle is being used and it is closed (the socket
21is disconnected or the process exits), this is detected and a callback
22to the owner object is made.
23
24This module is only used internally and should not be configured.