apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Neeley" <Sean.Nee...@ProducePro.com>
Subject RE: APR leaves port bound when terminated?
Date Wed, 22 Feb 2006 17:08:20 GMT
Someone sent me this patch on the tomcat mailing list, which I believe
does the same thing:

bash-2.03$ diff -c network.c network.c.orig
*** network.c   Mon Feb  6 12:50:54 2006
--- network.c.orig      Mon Feb  6 12:50:11 2006
***************
*** 385,391 ****
      UNREFERENCED_STDARGS;
      TCN_ASSERT(sock != 0);
      TCN_ASSERT(s->sock != NULL);
+     apr_socket_opt_set( s->sock, APR_SO_REUSEADDR, 1 );
      return (jint)apr_socket_bind(s->sock, a);
  }

- Sean

-----Original Message-----
From: Jim Jagielski [mailto:jim@jagunet.com] 
Sent: Wednesday, February 22, 2006 11:02 AM
To: Sean Neeley
Cc: Garrett Rooney; dev@apr.apache.org
Subject: Re: APR leaves port bound when terminated?

Sorry if this wasn't clear: the reason that SO_REUSEADDR
exists (and it's APR cousin) is to remove this
problem, and allow for the tcp/ip stack to
reuse it. So the fact that you're seeing this
is likely due to that option isn't being sent.

I believe the patch is to adjust
TCN_IMPLEMENT_CALL(jint, Socket, bind) in network.c
and add apr_socket_opt_set(s->sock, APR_SO_REUSEADDR, 1)
right before the apr_socket_bind call...

On Feb 21, 2006, at 7:05 PM, Sean Neeley wrote:

> I would be happy to test a version of APR with different socket  
> options.
> Thanks.
>
> - Sean
>
> -----Original Message-----
> From: rooneg@gmail.com [mailto:rooneg@gmail.com] On Behalf Of Garrett
> Rooney
> Sent: Tuesday, February 21, 2006 5:54 PM
> To: jim@jagunet.com
> Cc: Sean Neeley; dev@apr.apache.org
> Subject: Re: APR leaves port bound when terminated?
>
> On 2/21/06, Jim Jagielski <jim@jagunet.com> wrote:
>> I would guess this in an artifact of SO_REUSEADDR
>
> Actually, wouldn't setting SO_REUSEADDR (or APR_SO_REUSEADDR in this
> case) make the problem go away?  I'd assumed that the code in Tomcat
> just wasn't doing that or something.
>
> -garrett
>


Mime
View raw message