gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16398 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r16398 - gnunet/src/fs
Date: Fri, 5 Aug 2011 23:16:41 +0200

Author: grothoff
Date: 2011-08-05 23:16:40 +0200 (Fri, 05 Aug 2011)
New Revision: 16398

Modified:
   gnunet/src/fs/gnunet-search.c
Log:
LRN: 0007-Add-N-NUM-argument-to-quit-the-search-after-NUM-hits.patch

Modified: gnunet/src/fs/gnunet-search.c
===================================================================
--- gnunet/src/fs/gnunet-search.c       2011-08-05 21:16:38 UTC (rev 16397)
+++ gnunet/src/fs/gnunet-search.c       2011-08-05 21:16:40 UTC (rev 16398)
@@ -44,6 +44,10 @@
 
 static unsigned long long timeout;
 
+static unsigned int results_limit;
+
+static unsigned int results = 0;
+
 static int verbose;
 
 static int local_only;
@@ -177,6 +181,9 @@
       fflush(stdout);
       GNUNET_free_non_null (filename);
       GNUNET_free (uri);
+      results += 1;
+      if (results_limit > 0 && results >= results_limit)
+        GNUNET_SCHEDULER_shutdown ();
       break;
     case GNUNET_FS_STATUS_SEARCH_UPDATE:
       break;
@@ -320,12 +327,16 @@
      ("write search results to file starting with PREFIX"),
      1, &GNUNET_GETOPT_set_string, &output_filename}, 
     {'t', "timeout", "VALUE",
-     gettext_noop 
+     gettext_noop
      ("automatically terminate search after VALUE ms"),
      1, &GNUNET_GETOPT_set_ulong, &timeout},
     {'V', "verbose", NULL,
      gettext_noop ("be verbose (print progress information)"),
      0, &GNUNET_GETOPT_set_one, &verbose},
+    {'N', "results", "VALUE",
+     gettext_noop
+     ("automatically terminate search after VALUE results are found"),
+     1, &GNUNET_GETOPT_set_ulong, &results_limit},
     GNUNET_GETOPT_OPTION_END
   }; 
   return (GNUNET_OK ==




reply via email to

[Prev in Thread] Current Thread [Next in Thread]