[Wifidog] Status

Tony Bussieres tonyicemanz at yahoo.ca
Sat Mar 27 12:20:52 EST 2004


I think it's a good idea to take the socket manipulation out of the
libhttpd. But we can do it modifiing just a line or two of code.

We have already access to the server socket by doing : 
webserver->serverSock

And with the client socket with 
webserver->clientSock

My idea was to put a static int[] socket_states[FDMAX]
and define states such as : SOCKET_UNUSED, SOCKET_SERVER, SOCKET_CLIENT,
and two states for the connection to the central server :
SOCKET_AUTH_CONNECTING, SOCKET_AUTH_CONNECTED

the index in the array represents the socket itself for exemple 
socket_states[webserver->serverSock] will return SOCKET_SERVER.
when we are done with a socket we close it and toggle it to
SOCKET_UNUSED

in our main_loop  we can do a select on all the socket that are not in
UNUSED state.

for example if we have a read event on our server socket, that's because
someone is trying to connect to our gateway. it that moment we can call
the libhttpd function httpdGetConnection(...).There is a select in tha
function, but we don't care because it won't block.
Then we switch the client socket options to  O_NONBLOCK. and continue
our job with httpdReadRequest(...)


The only thing that we have to be aware is that we might have to 
modify the read/write operations in the libhttpd to support non blocking
sockets. I didn't look in the libhttp code either, we might have work on
that too.

The non-blocking "connect()" is a tricky one too (when our gateway will
connect to the central server), but I found an example in Unix Network
Programming (Stevens), it will be helpful.

I will try to free myself some time to work on that this week

Later

Tony

On Fri, 2004-03-26 at 23:30, Alexandre Carmel-Veilleux wrote:
> hello,
> 
> 	It seems that currently Wifidog is sort of taking a backseat.
> If what I posted about the asynch version of libhttpd is well received
> here, I might as well go ahead and do it this week. At least to make
> a proof of concept select-based web server.
> 
> 	Opinions anyone?
> 
> Cheers,
> 
> Alex
> 
> 
> ______________________________________________________________________
> _______________________________________________
> Wifidog mailing list
> Wifidog at isf.waglo.com
> http://isf.waglo.com/mailman/listinfo/wifidog_isf.waglo.com
-- 
May Linux be with you!


-------------- next part --------------
_______________________________________________
Wifidog mailing list
Wifidog at isf.waglo.com
http://isf.waglo.com/mailman/listinfo/wifidog_isf.waglo.com


More information about the Wifidog mailing list