aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-02-10 23:02:06 +0100
committerChristian Grothoff <christian@grothoff.org>2019-02-10 23:02:06 +0100
commit88ae0b0fd1508bb729592ef203b2e7e88980631c (patch)
tree2b5fa7456ff824667b370d94cb05e86c943a8995 /src/ats
parent7844da7bd860f5b55fe87083a7aa037b95df9ee7 (diff)
downloadgnunet-88ae0b0fd1508bb729592ef203b2e7e88980631c.tar.gz
gnunet-88ae0b0fd1508bb729592ef203b2e7e88980631c.zip
add some logging
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/gnunet-service-ats-new.c23
-rw-r--r--src/ats/test_ats2_lib.c13
2 files changed, 29 insertions, 7 deletions
diff --git a/src/ats/gnunet-service-ats-new.c b/src/ats/gnunet-service-ats-new.c
index dd65d54a2..a1666d8d3 100644
--- a/src/ats/gnunet-service-ats-new.c
+++ b/src/ats/gnunet-service-ats-new.c
@@ -213,6 +213,10 @@ suggest_cb (void *cls,
213 // FIXME: stats! 213 // FIXME: stats!
214 return; 214 return;
215 } 215 }
216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
217 "Suggesting address `%s' of peer `%s'\n",
218 address,
219 GNUNET_i2s (pid));
216 env = GNUNET_MQ_msg_extra (as, 220 env = GNUNET_MQ_msg_extra (as,
217 slen, 221 slen,
218 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION); 222 GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION);
@@ -253,6 +257,12 @@ allocate_cb (void *cls,
253 losses of sessions (possibly of previous transport), ignore! */ 257 losses of sessions (possibly of previous transport), ignore! */
254 return; 258 return;
255 } 259 }
260 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
261 "Allocating %u/%u bytes for %p of peer `%s'\n",
262 ntohl (bw_in.value__),
263 ntohl (bw_out.value__),
264 session,
265 GNUNET_i2s (peer));
256 env = GNUNET_MQ_msg (sam, 266 env = GNUNET_MQ_msg (sam,
257 GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION); 267 GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION);
258 sam->session_id = session->session_id; 268 sam->session_id = session->session_id;
@@ -307,6 +317,11 @@ handle_suggest (void *cls,
307 GNUNET_SERVICE_client_drop (c->client); 317 GNUNET_SERVICE_client_drop (c->client);
308 return; 318 return;
309 } 319 }
320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
321 "Client suggested we talk to %s with preference %d at rate %u\n",
322 GNUNET_i2s (&msg->peer),
323 (int) ntohl (msg->pk),
324 (int) ntohl (msg->bw.value__));
310 cp = GNUNET_new (struct ClientPreference); 325 cp = GNUNET_new (struct ClientPreference);
311 cp->client = c; 326 cp->client = c;
312 cp->pref.peer = msg->peer; 327 cp->pref.peer = msg->peer;
@@ -464,6 +479,10 @@ handle_session_add (void *cls,
464 &session->data, 479 &session->data,
465 address); 480 address);
466 GNUNET_assert (NULL != session->sh); 481 GNUNET_assert (NULL != session->sh);
482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
483 "Transport has new session %p to %s\n",
484 session,
485 GNUNET_i2s (&message->peer));
467 GNUNET_SERVICE_client_continue (c->client); 486 GNUNET_SERVICE_client_continue (c->client);
468} 487}
469 488
@@ -540,6 +559,10 @@ handle_session_del (void *cls,
540 GNUNET_CONTAINER_multihashmap32_remove (c->details.transport.sessions, 559 GNUNET_CONTAINER_multihashmap32_remove (c->details.transport.sessions,
541 session->session_id, 560 session->session_id,
542 session)); 561 session));
562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
563 "Transport lost session %p to %s\n",
564 session,
565 GNUNET_i2s (&session->data.peer));
543 GNUNET_free (session); 566 GNUNET_free (session);
544 GNUNET_SERVICE_client_continue (c->client); 567 GNUNET_SERVICE_client_continue (c->client);
545} 568}
diff --git a/src/ats/test_ats2_lib.c b/src/ats/test_ats2_lib.c
index 990eb0670..5c51e5322 100644
--- a/src/ats/test_ats2_lib.c
+++ b/src/ats/test_ats2_lib.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -31,13 +31,11 @@
31 */ 31 */
32static int ret; 32static int ret;
33 33
34
35/** 34/**
36 * @brief The time available until the test shuts down 35 * @brief The time available until the test shuts down
37 */ 36 */
38static struct GNUNET_TIME_Relative timeout; 37static struct GNUNET_TIME_Relative timeout;
39 38
40
41/** 39/**
42 * @brief ATS Application Handle 40 * @brief ATS Application Handle
43 * 41 *
@@ -64,6 +62,7 @@ static struct GNUNET_PeerIdentity other_peer;
64 */ 62 */
65static struct GNUNET_ATS_SessionRecord *sr; 63static struct GNUNET_ATS_SessionRecord *sr;
66 64
65
67/** 66/**
68 * @brief Called whenever allocation changed 67 * @brief Called whenever allocation changed
69 * 68 *
@@ -74,7 +73,7 @@ static struct GNUNET_ATS_SessionRecord *sr;
74 * @param bandwidth_out 73 * @param bandwidth_out
75 * @param bandwidth_in 74 * @param bandwidth_in
76 * 75 *
77 * @return 76 * @return
78 */ 77 */
79static void 78static void
80allocation_cb (void *cls, 79allocation_cb (void *cls,
@@ -116,9 +115,9 @@ init_both (const struct GNUNET_CONFIGURATION_Handle *cfg)
116 ah = GNUNET_ATS_application_init (cfg); 115 ah = GNUNET_ATS_application_init (cfg);
117 GNUNET_assert (NULL != ah); 116 GNUNET_assert (NULL != ah);
118 th = GNUNET_ATS_transport_init (cfg, 117 th = GNUNET_ATS_transport_init (cfg,
119 allocation_cb, 118 &allocation_cb,
120 NULL, 119 NULL,
121 suggestion_cb, 120 &suggestion_cb,
122 NULL); 121 NULL);
123 GNUNET_assert (NULL != ah); 122 GNUNET_assert (NULL != ah);
124} 123}
@@ -227,7 +226,7 @@ run (void *cls,
227 * @param argc 226 * @param argc
228 * @param argv[] 227 * @param argv[]
229 * 228 *
230 * @return 229 * @return
231 */ 230 */
232int 231int
233main (int argc, 232main (int argc,