Re: Immediate output in process_connection

2005-07-03 Thread Jem Berkes
> What is your Listen line for this protocol's port?

I just had Listen 1234

> Try something like:
> 
> Listen 0.0.0.0:1234 myproto
> AcceptFilter myproto none

Well that did indeed solve my problem :) Thanks.




Re: Immediate output in process_connection

2005-07-03 Thread Paul Querna
Jem Berkes wrote:
> I've been playing with basic modules that implement their own protocol 
> (process_connection hooked) along the lines of the mod_echo example. But 
> one thing I can't seem to do is send output immediately back to the client, 
> even though I am flushing the output filters.
> 
> With the following code, if I telnet localhost I don't see the "hello" 
> until I first send some line, or close the connection. Contrast to say a 
> POP3 server where you see the +greeting as soon as you connect. I did look 
> at the mod_pop3 code but can't understand what it does differently than 
> this. Do I have to explicitly do something with the input_filters here? 
> Currently I don't touch the input side, but something is introducing a 
> delay.
> 

What is your Listen line for this protocol's port?

Try something like:

Listen 0.0.0.0:1234 myproto
AcceptFilter myproto none

-Paul

> static int rdate_process_connection(conn_rec *c)
> {
>   apr_bucket_brigade *bb;
>   rdate_cfg* cfg = ap_get_module_config(c->base_server->module_config,
>   &rdate_module);
>   if (!cfg->rdate_enabled)
>   return DECLINED;
> 
>   bb = apr_brigade_create(c->pool, c->bucket_alloc);
>   ap_fprintf(c->output_filters, bb, "hello\n");
>   ap_fflush(c->output_filters, bb);
>   return OK;
> }
> 



Immediate output in process_connection

2005-07-03 Thread Jem Berkes
I've been playing with basic modules that implement their own protocol 
(process_connection hooked) along the lines of the mod_echo example. But 
one thing I can't seem to do is send output immediately back to the client, 
even though I am flushing the output filters.

With the following code, if I telnet localhost I don't see the "hello" 
until I first send some line, or close the connection. Contrast to say a 
POP3 server where you see the +greeting as soon as you connect. I did look 
at the mod_pop3 code but can't understand what it does differently than 
this. Do I have to explicitly do something with the input_filters here? 
Currently I don't touch the input side, but something is introducing a 
delay.

static int rdate_process_connection(conn_rec *c)
{
apr_bucket_brigade *bb;
rdate_cfg* cfg = ap_get_module_config(c->base_server->module_config,
&rdate_module);
if (!cfg->rdate_enabled)
return DECLINED;

bb = apr_brigade_create(c->pool, c->bucket_alloc);
ap_fprintf(c->output_filters, bb, "hello\n");
ap_fflush(c->output_filters, bb);
return OK;
}