void hsep_get_non_hsep_triple(hsep_triple *tripledest) { const GSList *sl; uint64 other_nodes = 0; /* # of non-HSEP nodes */ uint64 other_files = 0; /* what non-HSEP nodes share (files) */ uint64 other_kib = 0; /* what non-HSEP nodes share (KiB) */ g_assert(tripledest); /* * Iterate over all established non-HSEP nodes and count these nodes and * sum up what they share (PONG-based library size). */ for (sl = node_all_nodes() ; sl; sl = g_slist_next(sl)) { struct gnutella_node *n = sl->data; gnet_node_status_t status; if ((!NODE_IS_ESTABLISHED(n)) || n->attrs & NODE_A_CAN_HSEP) continue; other_nodes++; if (!node_get_status(NODE_ID(n), &status)) continue; if (status.gnet_info_known) { other_files += status.gnet_files_count; other_kib += status.gnet_kbytes_count; } } tripledest[0][HSEP_IDX_NODES] = other_nodes; tripledest[0][HSEP_IDX_FILES] = other_files; tripledest[0][HSEP_IDX_KIB] = other_kib; }
gboolean guc_node_get_status(const struct nid *node_id, gnet_node_status_t *s) { return node_get_status(node_id, s); }