Hi!

I've just tried distcc and the results are really awesome.

I'm sending a small patch which enhance the usabillity of distcc on my laptop where I use it at home and in the lab. The patch add code to check if a hostname can be resovlved before adding it to the hostlist.

With this patch, I can set all the name of the machine which I use, and, since the name of my home machine and the ones in the lab are not the same, only the locals hosts are added to the usable hosts list. Not exactly the autodetect solution, but it solve the problem in my case.

Yannick :)


-------------
diff -rc distcc-2.13.orig/src/exitcode.h distcc-2.13/src/exitcode.h
*** distcc-2.13.orig/src/exitcode.h 2004-02-29 23:16:32.000000000 -0500
--- distcc-2.13/src/exitcode.h 2004-04-07 22:06:05.000000000 -0400
***************
*** 53,59 ****
EXIT_BUSY = 114, /**< In use by another process. */
EXIT_NO_SUCH_FILE = 115,
EXIT_NO_HOSTS = 116,
! EXIT_GONE = 117 /**< No longer relevant */
};


--- 53,60 ----
EXIT_BUSY = 114, /**< In use by another process. */
EXIT_NO_SUCH_FILE = 115,
EXIT_NO_HOSTS = 116,
! EXIT_GONE = 117, /**< No longer relevant */
! EXIT_HOSTNAME_NO_RESOLV = 118
};



diff -rc distcc-2.13.orig/src/hosts.c distcc-2.13/src/hosts.c
*** distcc-2.13.orig/src/hosts.c        2004-02-29 23:16:32.000000000 -0500
--- distcc-2.13/src/hosts.c     2004-04-07 22:34:51.000000000 -0400
***************
*** 89,94 ****
--- 89,97 ----
  #include <errno.h>
  #include <time.h>
  #include <ctype.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>

  #include "distcc.h"
  #include "trace.h"
***************
*** 303,309 ****
              token = tail;
          }
      }
!
      if ((ret = dcc_parse_multiplier(&token, hostdef)) != 0)
          return ret;

--- 306,332 ----
              token = tail;
          }
      }
!
!     /* Check for hostname resolution */
!     struct addrinfo hints;
!     struct addrinfo *res;
!     int error;
!     char portname[20];
!     snprintf(portname, sizeof portname, "%d", hostdef->port);
!
!     /* set-up hints structure */
!     memset(&hints, 0, sizeof(hints));
!     hints.ai_family = PF_UNSPEC;
!     hints.ai_socktype = SOCK_STREAM;
!     error = getaddrinfo(hostdef->hostname, portname, &hints, &res);
!     if (error) {
!         rs_log_error("failed to resolve host %s port %d: %s",
!                      hostdef->hostname, hostdef->port,
!                      gai_strerror(error));
!         return EXIT_HOSTNAME_NO_RESOLV;
!     }
!
!
      if ((ret = dcc_parse_multiplier(&token, hostdef)) != 0)
          return ret;

***************
*** 428,435 ****
                  return ret;
          } else {
              rs_trace("found tcp token \"%.*s\"", token_len, token_start);
!             if ((ret = dcc_parse_tcp_host(curr, token_start)) != 0)
!                 return ret;
          }

          /* continue to next token if any */
--- 451,465 ----
                  return ret;
          } else {
              rs_trace("found tcp token \"%.*s\"", token_len, token_start);
!             if ((ret = dcc_parse_tcp_host(curr, token_start)) != 0) {
!                 if (EXIT_HOSTNAME_NO_RESOLV == ret) {
!                     /* continue to next token if any */
!                     where = token_start + token_len;
!                     continue;
!                 }
!                 else
!                     return ret;
!             }
          }

/* continue to next token if any */

Attachment: signature.asc
Description: OpenPGP digital signature

__ 
distcc mailing list            http://distcc.samba.org/
To unsubscribe or change options: 
http://lists.samba.org/mailman/listinfo/distcc

Reply via email to