aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-08 22:58:14 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-08 22:58:14 +0000
commit47435b4bc0f217b7b13b8e6fd513b3029cffd8c8 (patch)
treeec05a7ff1b75898238484e4a567a73fccf9524fb /src
parent03a39827ef721653ad9509ce12173bd674592caf (diff)
downloadgnunet-47435b4bc0f217b7b13b8e6fd513b3029cffd8c8.tar.gz
gnunet-47435b4bc0f217b7b13b8e6fd513b3029cffd8c8.zip
-fin, mention future work in TODO
Diffstat (limited to 'src')
-rw-r--r--src/ats/gnunet-service-ats_connectivity.c3
-rw-r--r--src/ats/plugin_ats_proportional.c14
-rw-r--r--src/ats/test_ats_solver_add_address.c40
-rw-r--r--src/include/gnunet_ats_service.h3
4 files changed, 33 insertions, 27 deletions
diff --git a/src/ats/gnunet-service-ats_connectivity.c b/src/ats/gnunet-service-ats_connectivity.c
index 3546f72dc..1ced117ca 100644
--- a/src/ats/gnunet-service-ats_connectivity.c
+++ b/src/ats/gnunet-service-ats_connectivity.c
@@ -41,6 +41,8 @@ struct ConnectionRequest
41 * Client that made the request. 41 * Client that made the request.
42 */ 42 */
43 struct GNUNET_SERVER_Client *client; 43 struct GNUNET_SERVER_Client *client;
44
45 /* TODO: allow client to express a 'strength' for this request */
44}; 46};
45 47
46 48
@@ -62,6 +64,7 @@ unsigned int
62GAS_connectivity_has_peer (void *cls, 64GAS_connectivity_has_peer (void *cls,
63 const struct GNUNET_PeerIdentity *peer) 65 const struct GNUNET_PeerIdentity *peer)
64{ 66{
67 /* TODO: return sum of 'strength's of connectivity requests */
65 return GNUNET_CONTAINER_multipeermap_contains (connection_requests, 68 return GNUNET_CONTAINER_multipeermap_contains (connection_requests,
66 peer); 69 peer);
67} 70}
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c
index d65cbb289..6fd7e42a1 100644
--- a/src/ats/plugin_ats_proportional.c
+++ b/src/ats/plugin_ats_proportional.c
@@ -1062,16 +1062,10 @@ GAS_proportional_address_add (void *solver,
1062 net->stat_total, 1062 net->stat_total,
1063 1, 1063 1,
1064 GNUNET_NO); 1064 GNUNET_NO);
1065 if (0 != 1065 update_active_address (s,
1066 s->env->get_connectivity (s->env->cls, 1066 get_active_address (s,
1067 &address->peer)) 1067 &address->peer),
1068 { 1068 &address->peer);
1069 /* This peer is requested, find best address */
1070 update_active_address (s,
1071 get_active_address (s,
1072 &address->peer),
1073 &address->peer);
1074 }
1075 LOG (GNUNET_ERROR_TYPE_INFO, 1069 LOG (GNUNET_ERROR_TYPE_INFO,
1076 "Added new address for `%s', now total %u and active %u addresses in network `%s'\n", 1070 "Added new address for `%s', now total %u and active %u addresses in network `%s'\n",
1077 GNUNET_i2s (&address->peer), 1071 GNUNET_i2s (&address->peer),
diff --git a/src/ats/test_ats_solver_add_address.c b/src/ats/test_ats_solver_add_address.c
index 70f506c38..b2f0eacd2 100644
--- a/src/ats/test_ats_solver_add_address.c
+++ b/src/ats/test_ats_solver_add_address.c
@@ -81,8 +81,11 @@ static uint32_t test_ats_count;
81 81
82 82
83static int 83static int
84stat_cb(void *cls, const char *subsystem, const char *name, uint64_t value, 84stat_cb (void *cls,
85 int is_persistent); 85 const char *subsystem,
86 const char *name,
87 uint64_t value,
88 int is_persistent);
86 89
87 90
88static void 91static void
@@ -90,7 +93,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
90{ 93{
91 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); 94 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n");
92 95
93 if (die_task != NULL) 96 if (NULL != die_task)
94 { 97 {
95 GNUNET_SCHEDULER_cancel (die_task); 98 GNUNET_SCHEDULER_cancel (die_task);
96 die_task = NULL; 99 die_task = NULL;
@@ -108,9 +111,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
108 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 111 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
109 stats = NULL; 112 stats = NULL;
110 } 113 }
111
112 free_test_address (&test_addr); 114 free_test_address (&test_addr);
113
114 ret = 0; 115 ret = 0;
115} 116}
116 117
@@ -132,19 +133,23 @@ address_suggest_cb (void *cls,
132 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 133 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
133 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 134 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
134{ 135{
135 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); 136 /* ignored in this test */
136 GNUNET_SCHEDULER_add_now (&end_badly, NULL);
137} 137}
138 138
139 139
140static int 140static int
141stat_cb(void *cls, const char *subsystem, 141stat_cb (void *cls,
142 const char *name, uint64_t value, 142 const char *subsystem,
143 int is_persistent) 143 const char *name,
144 uint64_t value,
145 int is_persistent)
144{ 146{
145 147
146 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n", 148 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
147 subsystem,name, value); 149 "ATS statistics: `%s' `%s' %llu\n",
150 subsystem,
151 name,
152 value);
148 if (1 == value) 153 if (1 == value)
149 { 154 {
150 GNUNET_SCHEDULER_add_now (&end, NULL); 155 GNUNET_SCHEDULER_add_now (&end, NULL);
@@ -152,9 +157,11 @@ stat_cb(void *cls, const char *subsystem,
152 return GNUNET_OK; 157 return GNUNET_OK;
153} 158}
154 159
160
155static void 161static void
156run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, 162run (void *cls,
157 struct GNUNET_TESTING_Peer *peer) 163 const struct GNUNET_CONFIGURATION_Handle *mycfg,
164 struct GNUNET_TESTING_Peer *peer)
158{ 165{
159 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); 166 die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
160 stats = GNUNET_STATISTICS_create ("ats", mycfg); 167 stats = GNUNET_STATISTICS_create ("ats", mycfg);
@@ -163,9 +170,10 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
163 170
164 /* Connect to ATS scheduling */ 171 /* Connect to ATS scheduling */
165 sched_ats = GNUNET_ATS_scheduling_init (mycfg, &address_suggest_cb, NULL); 172 sched_ats = GNUNET_ATS_scheduling_init (mycfg, &address_suggest_cb, NULL);
166 if (sched_ats == NULL) 173 if (NULL == sched_ats)
167 { 174 {
168 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n"); 175 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
176 "Could not connect to ATS scheduling!\n");
169 GNUNET_SCHEDULER_add_now (&end_badly, NULL); 177 GNUNET_SCHEDULER_add_now (&end_badly, NULL);
170 return; 178 return;
171 } 179 }
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index 3d4eed4d7..437984402 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -321,8 +321,9 @@ GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch);
321 * 321 *
322 * @param ch handle 322 * @param ch handle
323 * @param peer identity of the peer we need an address for 323 * @param peer identity of the peer we need an address for
324 * TODO: add argument to allow client to express 'strength's of request
324 * @return suggestion handle, NULL if request is already pending 325 * @return suggestion handle, NULL if request is already pending
325 */ 326 */
326struct GNUNET_ATS_ConnectivitySuggestHandle * 327struct GNUNET_ATS_ConnectivitySuggestHandle *
327GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, 328GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
328 const struct GNUNET_PeerIdentity *peer); 329 const struct GNUNET_PeerIdentity *peer);