Class: cogen.web.async.Read
This is actually a hack that mixes ReadAll and ReadLine and patches their state attributes. Hopefully i'll evolve it to something more elegant at some point.
Constructor
__init__ (self, conn, req, len=4096, **kws)
Initial req object holds the state of the operations involving reading the input and it requires to have these attributes:
- read_chunked = <bool>
- content_length = <int>
- read_count = 0
- state = async.Read.NEED_SIZE
These have to be initialized in the request.
Methods
check_overflow (self)
cleanup (self, sched, coro)
finalize (self)
iocp (self, overlap)
iocp_done (self, rc, nbytes)
pending (self)
process (self, sched, coro)
Add the operation in the reactor if necessary.
run (self, reactor)
~ @debug(0)
try_run (self, reactor)
This method will return a None value or raise a exception if the operation can't complete at this time.
The socket poller will run this method if the socket is readable/writeable.
If this returns a value that evaluates to False, the poller will try to run this at a later time (when the socket is readable/writeable again).
Attributes
NEED_CHUNK
Value of NEED_CHUNK
1
NEED_HEAD
Value of NEED_HEAD
3
NEED_NONE
Value of NEED_NONE
4
NEED_SIZE
Value of NEED_SIZE
0
NEED_TERM
Value of NEED_TERM
2
addr
Value of addr
<member 'addr' of 'SocketOperation' objects>
buff
Value of buff
<member 'buff' of 'SocketOperation' objects>
fileno
Value of fileno
<member 'fileno' of 'SocketOperation' objects>
iocp_buff
Value of iocp_buff
<member 'iocp_buff' of 'ReadOperation' objects>
last_update
Value of last_update
<member 'last_update' of 'SocketOperation' objects>
len
Value of len
<member 'len' of 'SocketOperation' objects>
prio
Value of prio
<member 'prio' of 'Operation' objects>
req
Value of req
<member 'req' of 'Read' objects>
run_first
Value of run_first
<member 'run_first' of 'SocketOperation' objects>
sock
Value of sock
<member 'sock' of 'SocketOperation' objects>
state
Value of state
<member 'state' of 'Operation' objects>
temp_buff
Value of temp_buff
<member 'temp_buff' of 'ReadOperation' objects>
trim
Value of trim
2000
weak_timeout
Value of weak_timeout
<member 'weak_timeout' of 'TimedOperation' objects>
x_buff
Value of x_buff
<member 'x_buff' of 'Read' objects>
x_buff_sz
Value of x_buff_sz
<member 'x_buff_sz' of 'Read' objects>
x_ck_sz
Value of x_ck_sz
<member 'x_ck_sz' of 'Read' objects>
x_len
Value of x_len
<member 'x_len' of 'Read' objects>