1460998e0SShuo ChenEngineering a Reactor 2460998e0SShuo Chen -- how to write a non-blocking network library from scratch. 3460998e0SShuo Chen 4460998e0SShuo ChenStep 0: a do-nothing event loop 542bf2220SShuo Chen EventLoop, assertInLoopThread() 6cc7f415cSShuo Chen test1: poll for 10 seconds, creates two threads, each one has an EventLoop 7460998e0SShuo Chen test2: abort() as it accesses event loop created in a different thread 8460998e0SShuo Chen 942bf2220SShuo ChenStep 1: prototype of reactor 1042bf2220SShuo Chen Channel, Poller, updateChannel(). 11cc7f415cSShuo Chen test1: poll for ever, creates two threads, each one has an EventLoop 1242bf2220SShuo Chen test2: same as before 1342bf2220SShuo Chen test3: poll a timerfd, which expires in 5 seconds 1442bf2220SShuo Chen 1542bf2220SShuo ChenStep 2: TimerQueue 1642bf2220SShuo Chen TimerQueue, Timer, TimerId, EventLoop::runAfter, EventLoop::runEvery 17cc7f415cSShuo Chen not thread safe 18cc7f415cSShuo Chen test4: timer queue unittest 1942bf2220SShuo Chen 2040161064SShuo ChenStep 3: wakeup(), runInLoop(), EventLoopThread 219807252eSShuo Chen test5: runInLoop(), runAfter() in loop thread 229807252eSShuo Chen test6: runInLoop(), runAfter() in a different thread 2342bf2220SShuo Chen 2442bf2220SShuo ChenStep 4: Acceptor 25e54e5389SShuo Chen test7: listen on port 9981, accept, send, and close 2642bf2220SShuo Chen 27129fe122SShuo ChenStep 5: TcpServer, create TcpConnection 28129fe122SShuo Chen test8: use of TcpServer, discard server 2942bf2220SShuo Chen 30714cd85fSShuo ChenStep 6: TcpConnection passive close 3142bf2220SShuo Chen 32714cd85fSShuo ChenStep 7: TcpConnection read with Buffer, add receiveTime to read callback 33714cd85fSShuo Chen test3: show receiveTime 34714cd85fSShuo Chen test8: show receiveTime 35e54e5389SShuo Chen 36129fe122SShuo ChenStep 8: TcpConnection write 37129fe122SShuo Chen test9: echo server 38129fe122SShuo Chen test10: data source server 3942bf2220SShuo Chen 40129fe122SShuo ChenStep 9: write complete callback, tcp no delay, SIGPIPE 41129fe122SShuo Chen test11: chargen server 4242bf2220SShuo Chen 4340161064SShuo ChenStep 10: multithreaded TcpServer, EventLoopThreadPool 4440161064SShuo Chen test8,9,10,11: support multithreads 4542bf2220SShuo Chen 46f4e8e3d3SShuo ChenStep 11: Connector, TimerQueue::cancel() 4740161064SShuo Chen test12: 4842bf2220SShuo Chen 495f8e07deSShuo ChenStep 12: TcpClient 5040161064SShuo Chen test13: 515f8e07deSShuo Chen 5240161064SShuo ChenStep 13: epoll, EPoller 5340161064SShuo Chen 54