[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaSocket, LTN12 and coroutines: how to? (long post)
- From: David Burgess <dburgess@...>
- Date: Sat, 29 Jan 2005 19:34:27 +1000
Yep I can confirm it was a long post.
The basic logic methinks should work, tis good to have a starting point.
Preliminary Comments::
I assume a non-blocking accept().
You forgot the listening socket(s), yes a map is needed of sockets ready to read
remember that the accepting socket would be expected to be in this list and
the accepting socket should be the first one serviced, the accepting socket
should also be checked (again) before the write coroutine is invoked. That is,
each time you check one of the lists, check the listener first, lest the listen
queue explodes.
I would restate the transition from reading mode to writng mode as (assuming a
request/response type server):
when the read is complete the socket is added to the "want-to-send" list or
the "want-to-close" list. Methinks its simpler if this happens in the
"read" routine.
(i.e. Chaining)
I presume that you assume that the receiving routine is maintaining a
state and readbuffer
for each connection? Yes/No?
DB
PS I struggle with co-routines.