Hi, all This week I devoted most of my time in preparing for my final examinations, while I had also finished a coroutine version of the echo tcp server which makes use of the coroutine module I already implemented previously.
The echo server works as follows: - Before we can accept any new incoming sockets, we must create a socket for listening purpose. We register a function which accepts new sockets as many as it can, and switch back to main context when there is no more. We must register the listening socket to the epoll instance to get notified when events occur. - The main loop of the server takes care of the epoll_wait, while there is some available events occur on a socket, we just resume the context of that given socket by calling coro_resume. - For every socket from clients, currently the handling function of a socket simply reads from the given socket and writes everything back. If there is no more pending data for reading, it just yield and switch back to the main context. Of course, every socket shall be registered to the epoll instance about some events we care about. Problems I'm encountering is the warnings and errors from valgrind, user space context switching just make it crazy. Currently I'm also doing some survey and see how I can make them gone. And yep, lwan is a good reference for such black magic ;-). For the next week, I will be hunting and fixing valgrind errors and warnings. Blog Post: http://blog-swpd.rhcloud.com/gsoc-2014-update-duda-io-coroutines-week-4/ Github Repo: https://github.com/swpd/coroutine Best Regards, swpd
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
