- struct PerformanceClient *pc;
- struct PerformanceMonitorClient *res;
- struct MonitorMessage *mm = (struct MonitorMessage *) message;
- size_t msg_size;
- uint32_t id;
- uint32_t op;
-
- pc = find_client (client);
- if (NULL == pc)
- {
- GNUNET_break (0);
- return;
- }
-
- msg_size = ntohs (message->size);
- if (msg_size < sizeof (struct MonitorMessage))
- return;
-
- id = ntohl (mm->id);
- op = ntohl (mm->op);
-
- for (res = pc->pm_head; NULL != res; res = res->next)
- if ((res->id == id) && (client == res->client))
- break;
-
- if (GNUNET_YES == op)
- {
- /* Start monitoring */
- if (NULL != res)
- {
- GNUNET_break (0);
- return; /* Duplicate*/
- }
- res = GNUNET_malloc (sizeof (struct PerformanceMonitorClient));
- res->client = client;
- res->id = id;
- GNUNET_CONTAINER_DLL_insert (pc->pm_head, pc->pm_tail, res);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Added performance monitoring client %p id %u\n",
- client, id);
- }
- else if (GNUNET_NO == op)
- {
- /* Stop monitoring */
- if (NULL == res)
- {
- GNUNET_break (0);
- return; /* Not existing */
- }
- GNUNET_CONTAINER_DLL_remove (pc->pm_head, pc->pm_tail, res);
- GNUNET_free (res);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removed performance monitoring client %p id %u\n",
- client, id);
- }
- else
- {
- GNUNET_break (0);
- return;
- }
-
+/* Notify here */
+ GAS_performance_notify_all_clients (peer,
+ plugin_name,
+ plugin_addr, plugin_addr_len,
+ active,
+ ats, ats_count,
+ bandwidth_out, bandwidth_in);
+
+#if 0
+ struct PerformanceClient *cur;
+ struct PerformanceMonitorClient *curm;
+ struct MonitorResponseMessage *mrm;
+ size_t msglen;
+
+ msglen = sizeof (struct MonitorResponseMessage) +
+ ats_count * sizeof (struct GNUNET_ATS_Information);
+ mrm = GNUNET_malloc (msglen);
+
+ mrm->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_MONITOR_RESPONSE);
+ mrm->header.size = htons (msglen);
+ mrm->ats_count = htonl (ats_count);
+ mrm->peer = *peer;
+ memcpy (&mrm[1], ats, ats_count * sizeof (struct GNUNET_ATS_Information));
+
+ for (cur = pc_head; NULL != cur; cur = cur->next)
+ for (curm = cur->pm_head; NULL != curm; curm = curm->next)
+ {
+ /* Notify client about update */
+ mrm->id = htonl (curm->id);
+ GNUNET_SERVER_notification_context_unicast (nc,
+ cur->client,
+ (struct GNUNET_MessageHeader *) mrm,
+ GNUNET_YES);
+ }
+ GNUNET_free (mrm);
+#endif