[tbnl-devel] Re: [mod-lisp-devel] Multiple mod_lisps

Edi Weitz edi at agharta.de
Tue Aug 3 05:41:53 UTC 2004


On Mon, 02 Aug 2004 11:05:23 +0200, Edi Weitz <edi at agharta.de> wrote:

> @@ -431,11 +442,13 @@
>  #ifndef WIN32
>    if (LispSocket)
>      {
> -      if (UnsafeLispSocket)
> +      if (UnsafeLispSocket || strcmp(cfg->LispServerIP, LispServerIP) || cfg->LispServerPort != LispServerPort)
>          {
>            ap_pclosesocket(SocketPool, LispSocket);
>            LispSocket = 0;
>            UnsafeLispSocket = 0;
> +          LispServerIP[0] = 0;
> +          LispServerPort = 0;
>          }
>        else
>          return LispSocket;

As a micro-optimization one might want to replace the line above with

  +      if (UnsafeLispSocket || cfg->LispServerPort != LispServerPort || strcmp(cfg->LispServerIP, LispServerIP))

Comparing two longs should generally be faster than calling strcmp and
it's not unlikely that that the different Lisp images will be on the
same machine but use different ports.

Cheers,
Edi.




More information about the Tbnl-devel mailing list