diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-20 09:33:04 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-20 09:33:04 +0000 |
commit | 9e64a03e8979bd9139f3ccf6222f24fe541cda9e (patch) | |
tree | 07dcc1f5cb98fcf81794dd52633aa12b64f26d41 /src/ats | |
parent | 110f7cda16a96257ad4bdcf604b1e188a00a1200 (diff) | |
download | gnunet-9e64a03e8979bd9139f3ccf6222f24fe541cda9e.tar.gz gnunet-9e64a03e8979bd9139f3ccf6222f24fe541cda9e.zip |
initial cb
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/ats_api_performance.c | 16 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 10 | ||||
-rw-r--r-- | src/ats/test_ats_api_performance_monitor.c | 8 |
3 files changed, 27 insertions, 7 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index cbf18a0cc..34f3a232e 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -582,14 +582,23 @@ process_mr_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
582 | uint32_t ats_count; | 582 | uint32_t ats_count; |
583 | uint32_t id; | 583 | uint32_t id; |
584 | 584 | ||
585 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
586 | _("Received %s message\n"), "ATS_MONITOR_RESPONSE"); | ||
587 | |||
585 | msg_size = ntohs (msg->size); | 588 | msg_size = ntohs (msg->size); |
586 | if (msg_size < sizeof (struct MonitorResponseMessage)) | 589 | if (msg_size < sizeof (struct MonitorResponseMessage)) |
590 | { | ||
591 | GNUNET_break (0); | ||
587 | return GNUNET_SYSERR; | 592 | return GNUNET_SYSERR; |
593 | } | ||
588 | 594 | ||
589 | ats_count = ntohl (mrm->ats_count); | 595 | ats_count = ntohl (mrm->ats_count); |
590 | if (msg_size != (sizeof (struct MonitorResponseMessage) + | 596 | if (msg_size != (sizeof (struct MonitorResponseMessage) + |
591 | ats_count * sizeof (struct GNUNET_ATS_Information))) | 597 | ats_count * sizeof (struct GNUNET_ATS_Information))) |
592 | return GNUNET_SYSERR; | 598 | { |
599 | GNUNET_break (0); | ||
600 | return GNUNET_SYSERR; | ||
601 | } | ||
593 | 602 | ||
594 | id = ntohl (mrm->id); | 603 | id = ntohl (mrm->id); |
595 | /* Do work here */ | 604 | /* Do work here */ |
@@ -600,7 +609,10 @@ process_mr_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
600 | } | 609 | } |
601 | 610 | ||
602 | if (NULL == cur) | 611 | if (NULL == cur) |
603 | return GNUNET_SYSERR; | 612 | { |
613 | GNUNET_break (0); | ||
614 | return GNUNET_SYSERR; | ||
615 | } | ||
604 | 616 | ||
605 | ats = (struct GNUNET_ATS_Information *) &mrm[1]; | 617 | ats = (struct GNUNET_ATS_Information *) &mrm[1]; |
606 | cur->moncb (cur->moncb_cls, &mrm->peer, ats, ats_count); | 618 | cur->moncb (cur->moncb_cls, &mrm->peer, ats, ats_count); |
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index 74b9650c9..cbbed1967 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -542,6 +542,7 @@ GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer, | |||
542 | mrm->header.size = htons (msglen); | 542 | mrm->header.size = htons (msglen); |
543 | mrm->ats_count = htonl (ats_count); | 543 | mrm->ats_count = htonl (ats_count); |
544 | mrm->peer = *peer; | 544 | mrm->peer = *peer; |
545 | memcpy (&mrm[1], ats, sizeof (struct GNUNET_ATS_Information)); | ||
545 | 546 | ||
546 | for (cur = pc_head; NULL != cur; cur = cur->next) | 547 | for (cur = pc_head; NULL != cur; cur = cur->next) |
547 | for (curm = cur->pm_head; NULL != curm; curm = curm->next) | 548 | for (curm = cur->pm_head; NULL != curm; curm = curm->next) |
@@ -582,17 +583,17 @@ mon_peerinfo_it (void *cls, | |||
582 | 583 | ||
583 | mrm->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_MONITOR_RESPONSE); | 584 | mrm->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_MONITOR_RESPONSE); |
584 | mrm->header.size = htons (msglen); | 585 | mrm->header.size = htons (msglen); |
586 | mrm->id = htonl(pmc->id); | ||
585 | mrm->ats_count = htonl (atsi_count); | 587 | mrm->ats_count = htonl (atsi_count); |
586 | mrm->peer = *id; | 588 | mrm->peer = *id; |
587 | mrm->id = pmc->id; | 589 | memcpy (&mrm[1], atsi, sizeof (struct GNUNET_ATS_Information)); |
588 | 590 | ||
589 | /* Send initial information about peers to client */ | 591 | /* Send initial information about peers to client */ |
590 | /* | 592 | |
591 | GNUNET_SERVER_notification_context_unicast (nc, | 593 | GNUNET_SERVER_notification_context_unicast (nc, |
592 | pmc->client, | 594 | pmc->client, |
593 | (struct GNUNET_MessageHeader *) mrm, | 595 | (struct GNUNET_MessageHeader *) mrm, |
594 | GNUNET_YES); | 596 | GNUNET_YES); |
595 | */ | ||
596 | GNUNET_free (mrm); | 597 | GNUNET_free (mrm); |
597 | } | 598 | } |
598 | 599 | ||
@@ -661,9 +662,8 @@ GAS_handle_monitor (void *cls, | |||
661 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 662 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
662 | "Added performance monitoring client %p id %u\n", | 663 | "Added performance monitoring client %p id %u\n", |
663 | client, id); | 664 | client, id); |
664 | |||
665 | /* Return all values here */ | 665 | /* Return all values here */ |
666 | GAS_addresses_iterate_peers (GSA_addresses, &mon_peer_it, pc); | 666 | GAS_addresses_iterate_peers (GSA_addresses, &mon_peer_it, pmc); |
667 | 667 | ||
668 | } | 668 | } |
669 | else if (GNUNET_NO == op) | 669 | else if (GNUNET_NO == op) |
diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c index 6187a87e1..32ec27db8 100644 --- a/src/ats/test_ats_api_performance_monitor.c +++ b/src/ats/test_ats_api_performance_monitor.c | |||
@@ -149,6 +149,14 @@ perf_mon_cb (void *cls, | |||
149 | struct GNUNET_ATS_Information *ats, | 149 | struct GNUNET_ATS_Information *ats, |
150 | uint32_t ats_count) | 150 | uint32_t ats_count) |
151 | { | 151 | { |
152 | static int stage_counter = 0; | ||
153 | if (0 == stage_counter) | ||
154 | { | ||
155 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received initial callback\n"); | ||
156 | stage_counter ++; | ||
157 | } | ||
158 | |||
159 | |||
152 | 160 | ||
153 | } | 161 | } |
154 | 162 | ||