chiark / gitweb /
Changes as from fanf in his message of 11th May 2000.
authorian <ian>
Sat, 16 Sep 2000 19:13:11 +0000 (19:13 +0000)
committerian <ian>
Sat, 16 Sep 2000 19:13:11 +0000 (19:13 +0000)
client/adnslogres.c

index b8e5f52a000b2553d50d1e2b8bcf369dc838ee10..ac2aad8a64261f944cab8b94cde26f96083bdb09 100644 (file)
@@ -4,12 +4,12 @@
  */
 /*
  *  This file is
- *   Copyright (C) 1999 Tony Finch <dot@dotat.at>
+ *   Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
  *   Copyright (C) 1999-2000 Ian Jackson <ian@davenant.greenend.org.uk>
  *
  *  It is part of adns, which is
  *    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
- *    Copyright (C) 1999 Tony Finch <dot@dotat.at>
+ *    Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -48,7 +48,8 @@ static const char * const cvsid =
 #include "adns.h"
 
 /* maximum number of concurrent DNS queries */
-#define MAXPENDING 1000
+#define MAXPENDING 64000
+#define MAXPENDING 64000
 
 /* maximum length of a line */
 #define MAXLINE 1024
@@ -204,12 +205,13 @@ static void proclog(FILE *inf, FILE *outf, int opts) {
 }
 
 static void usage(void) {
-  fprintf(stderr, "usage: %s [-d] [-p] [logfile]\n", progname);
+  fprintf(stderr, "usage: %s [-d] [-p] [-c concurrency] [logfile]\n", progname);
   exit(1);
 }
 
 int main(int argc, char *argv[]) {
-  int c, opts;
+  int c, opts, maxpending;
+  extern char *optarg;
   FILE *inf;
 
   progname= strrchr(*argv, '/');
@@ -217,10 +219,18 @@ int main(int argc, char *argv[]) {
     progname++;
   else
     progname= *argv;
-  opts= 0;
 
-  while ((c= getopt(argc, argv, "dp")) != -1)
+  maxpending= MAXPENDING;
+  opts= 0;
+  while ((c= getopt(argc, argv, "c:dp")) != -1)
     switch (c) {
+    case 'c':
+      maxpending= atoi(optarg);
+      if (maxpending < 1 || maxpending > MAXPENDING) {
+       fprintf(stderr, "%s: unfeasible concurrency %d\n", progname, maxpending);
+       exit(1);
+      }
+      break;
     case 'd':
       opts|= OPT_DEBUG;
       break;
@@ -245,7 +255,7 @@ int main(int argc, char *argv[]) {
   if (!inf)
     aargh("couldn't open input");
 
-  proclog(inf, stdout, opts);
+  proclog(inf, stdout, maxpending, opts);
 
   if (fclose(inf))
     aargh("fclose input");