From: Stephen D. <sd...@gm...> - 2008-09-14 20:46:06
|
On Fri, Sep 12, 2008 at 3:08 AM, Vlad Seryakov <vl...@cr...> wrote: > I agree about making modules take care as much as possible. > > But here are the questions i need to resolve: > > - init, socket needs to be created, UDP or TCP or Unix, so driver needs > initProc > > - for module like UDP, driver needs to know not to accept or we need > another proc called acceptProc, default will be using accept and treat > socket as TCP but drier can ovwerwrite with its own > > - queuing, at some point, after accept or later driver need to queue > socket. The reason behind QUEUE_ON_ACCEPT to take care basic stuff > without writing same code for creating separate thread for slitening and > accepting sockets. SMTP is a good example in nssmtp. > QUEUE_ONREAD is usefull in case of UDP sockets, after reading UDP packet > call registered proc > > So, i need to resolve these issues and i would like to move as much as > possible into drivers. > > Any suggestions? Yeah, create listen and accept callbacks. I think TCP drivers should work fine -- I did that ages ago with the example pop3 driver. The UDP though... Maybe they should just read the packet in the accept callback, stash it, fake-up the HTTP request line in the Read callback, and the conn thread can then access the stashed packet directly. I'll have another go at it later, but here's some cleaned and split patches anyway, if you get a chance. |