diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-04-10 15:25:40 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-04-10 15:25:40 +0000 |
commit | 69c4cadf98b00ca8b7ee8ff8787de2bb8d4ac768 (patch) | |
tree | a54f554a82926f348a67d6a99242ad59e231c76a /src | |
parent | 77e2b5831b45e6a22c5218cbcfb46175c3411a66 (diff) | |
download | gnunet-69c4cadf98b00ca8b7ee8ff8787de2bb8d4ac768.tar.gz gnunet-69c4cadf98b00ca8b7ee8ff8787de2bb8d4ac768.zip |
- fix
Diffstat (limited to 'src')
-rw-r--r-- | src/regex/gnunet-regex-profiler.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 2fe248f1e..c4029d2c7 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define FIND_TIMEOUT \ | 39 | #define FIND_TIMEOUT \ |
40 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90) | 40 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90) |
41 | #define SEARCHES_IN_PARALLEL 100 | 41 | #define SEARCHES_IN_PARALLEL 5 |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * DLL of operations | 44 | * DLL of operations |
@@ -337,11 +337,6 @@ static int num_search_strings; | |||
337 | static unsigned int parallel_searches; | 337 | static unsigned int parallel_searches; |
338 | 338 | ||
339 | /** | 339 | /** |
340 | * Index of peer/string search. | ||
341 | */ | ||
342 | static unsigned int peer_cnt; | ||
343 | |||
344 | /** | ||
345 | * Number of peers found with search strings. | 340 | * Number of peers found with search strings. |
346 | */ | 341 | */ |
347 | static unsigned int peers_found; | 342 | static unsigned int peers_found; |
@@ -967,32 +962,31 @@ find_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
967 | static void | 962 | static void |
968 | find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 963 | find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
969 | { | 964 | { |
965 | unsigned int search_peer = (unsigned int) (long) cls; | ||
966 | |||
970 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || | 967 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || |
971 | peer_cnt >= num_search_strings) | 968 | search_peer >= num_search_strings) |
972 | return; | 969 | return; |
973 | 970 | ||
974 | peers[peer_cnt].search_str = search_strings[peer_cnt]; | ||
975 | peers[peer_cnt].search_str_matched = GNUNET_NO; | ||
976 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 971 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
977 | "Searching for string \"%s\" on peer %d with file %s (%u||)\n", | 972 | "Searching for string \"%s\" on peer %d with file %s (%u||)\n", |
978 | peers[peer_cnt].search_str, | 973 | peers[search_peer].search_str, |
979 | peer_cnt, | 974 | search_peer, |
980 | peers[peer_cnt].policy_file, | 975 | peers[search_peer].policy_file, |
981 | parallel_searches); | 976 | parallel_searches); |
982 | 977 | ||
983 | peers[peer_cnt].op_handle = | 978 | peers[search_peer].op_handle = |
984 | GNUNET_TESTBED_service_connect (NULL, | 979 | GNUNET_TESTBED_service_connect (NULL, |
985 | peers[peer_cnt].peer_handle, | 980 | peers[search_peer].peer_handle, |
986 | "dht", | 981 | "dht", |
987 | &dht_connect_cb, | 982 | &dht_connect_cb, |
988 | &peers[peer_cnt], | 983 | &peers[search_peer], |
989 | &dht_ca, | 984 | &dht_ca, |
990 | &dht_da, | 985 | &dht_da, |
991 | &peers[peer_cnt]); | 986 | &peers[search_peer]); |
992 | peers[peer_cnt].timeout = GNUNET_SCHEDULER_add_delayed (FIND_TIMEOUT, | 987 | peers[search_peer].timeout = GNUNET_SCHEDULER_add_delayed (FIND_TIMEOUT, |
993 | &find_timeout, | 988 | &find_timeout, |
994 | &peers[peer_cnt]); | 989 | &peers[search_peer]); |
995 | peer_cnt++; | ||
996 | } | 990 | } |
997 | 991 | ||
998 | 992 | ||
@@ -1090,7 +1084,7 @@ arm_start_cb (void *cls, struct GNUNET_ARM_Handle *arm, | |||
1090 | GNUNET_SCHEDULER_add_now (&arm_op_done, peer); | 1084 | GNUNET_SCHEDULER_add_now (&arm_op_done, peer); |
1091 | 1085 | ||
1092 | { | 1086 | { |
1093 | long search_peer; | 1087 | unsigned long search_peer; |
1094 | unsigned int i; | 1088 | unsigned int i; |
1095 | unsigned int me; | 1089 | unsigned int me; |
1096 | 1090 | ||
@@ -1106,6 +1100,7 @@ arm_start_cb (void *cls, struct GNUNET_ARM_Handle *arm, | |||
1106 | GNUNET_abort (); /* we ran out of peers, must be a bug */ | 1100 | GNUNET_abort (); /* we ran out of peers, must be a bug */ |
1107 | } | 1101 | } |
1108 | peers[search_peer].search_str = search_strings[me]; | 1102 | peers[search_peer].search_str = search_strings[me]; |
1103 | peers[search_peer].search_str_matched = GNUNET_NO; | ||
1109 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply( | 1104 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply( |
1110 | reannounce_period_max, | 1105 | reannounce_period_max, |
1111 | 2), | 1106 | 2), |