httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <sor...@gmail.com>
Subject Re: Detecting when KeepAlive connection timeouts (retrieving the browser fd)
Date Mon, 24 Aug 2009 07:11:43 GMT
On Mon, Aug 24, 2009 at 00:08, Alexander
Farber<alexander.farber@gmail.com> wrote:
> Hello,
>
> I have a multiplayer game with Flash clients:
>
> 1) The Flash client sends HTTP requests to the Apache module,
> 2) then the module write()s it over a Unix pipe to the game daemon,
> 3) then the Apache module read()s the daemon's response
> 4) and finally ap_rwrite()s it back to the browser.
>
> Because I want to implement a "server push",
> my game daemon doesn't write() anything back
> to the Apache module when there are no new infos,
> but blocks instead (i.e. the step 3 above blocks).
>
> When the blocking HTTP requests timeouts,
> I notice this at the Flash client and just restart it.
>
> My problem is that at the game daemon side
> I don't notice this, since the Apache module
> itself can only notice the timeout in the step 4
> (but it doesn't come sofar - it blocks in step 3).
>
> So I think I should select() or poll() on 2 fds
> in my Apache module - one is the Unix pipe
> to the game daemon and another fd should
> be the socket fd to the browser.
>
> My question is how do I retrieve the latter fd,
> so that I can select() or poll() on it?
>

Hook pre_connection(conn_rec *c, void *csd)

The csd is the abstract type apr_socket_t. This one has a field
socketdes. I think this is the descriptor you are looking for.

Please note that I base my recommendation on Apache 2.2.x (not 1.3.x)!
Also, I have not tried out the solution I'm proposing ;-).

S

> Thank you
> Alex
>
> PS: I'm using Apache 1.3.29 on OpenBSD 4.5 with
>   "KeepAlive On" and "KeepAliveTimeout 300"
>



-- 
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Mime
View raw message