nobu.nokada / softhome.net wrote in message news:<200207230819.g6N8JHc16852 / sharui.nakada.kanuma.tochigi.jp>...
> Hi,
> 
> At Tue, 23 Jul 2002 07:45:28 +0900,
> Domingo Alvarez Duarte wrote:
> > Looking in a way to use ruby to make some servers (like
> > http,pop3,smtp) I discovered that the TCPServer implementation doesn't
> > allow set the queue_length size that is passed to "listen" and it uses
> > a fixed value of "5".
> 
> Is it late setting after TCPServer.new?
> 
>   server = TCPServer.new('127.0.0.1',port)
>   server.listen(511)
> 
> > After applying this patch the TCPServer accepts a third parameter for
> > the queue_length:
> 
> I'm not against to adding the parameter, but 
> 
> > diff from the ruby-1.6.7/ext/socket/socket.c
> We perfer unified diff (and I like to use -p option).
> 
> > cut from here ------------------------------------------
> > 787c787
> > < open_inet(class, h, serv, type)
> > ---
> > > open_inet2(class, h, serv, queue_length, type)
> > 873c873
> > <       listen(fd, 5);
> > ---
> > >       listen(fd, FIX2INT(queue_length));
> 
> queue_length in open_inet2() seems a VALUE.
> 
> > 880a881,888
> > > open_inet(class, h, serv, type)
> > >     VALUE class, h, serv;
> > >     int type;
> > > {
> > >     return open_inet2(class,h,serv,5,type);
> > > }
> 
> But here an int 5 is passed.

You are right about the formal parameter, although a VALUE is equal an
int and the compiler didn't complained, lets change that to:

open_inet(class, h, serv, type)
  VALUE class, h, serv;
  int type;
 {
     return open_inet2(class,h,serv,INT2FIX(5),type);
 }

And trying to set the listen queue after new doesn't work .