aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-10 20:48:06 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-10 20:48:06 +0000
commitdb6519d18c041f02a45025064c6c2dc61c5e7306 (patch)
tree0139839bcfd24a40b3690581943ca791678d6da1
parentc33cc77cac860fcdc8241be40ea5094628bd6a40 (diff)
downloadgnunet-gtk-db6519d18c041f02a45025064c6c2dc61c5e7306.tar.gz
gnunet-gtk-db6519d18c041f02a45025064c6c2dc61c5e7306.zip
-integrating gnunet-peerinfo-gtk with ATS performance API
-rw-r--r--src/peerinfo/Makefile.am2
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk.c40
2 files changed, 20 insertions, 22 deletions
diff --git a/src/peerinfo/Makefile.am b/src/peerinfo/Makefile.am
index 97bad8dc..26c6e206 100644
--- a/src/peerinfo/Makefile.am
+++ b/src/peerinfo/Makefile.am
@@ -17,7 +17,7 @@ gnunet_peerinfo_gtk_LDADD = \
17 $(top_builddir)/src/lib/libgnunetgtk.la \ 17 $(top_builddir)/src/lib/libgnunetgtk.la \
18 @GTK_LIBS@ \ 18 @GTK_LIBS@ \
19 @GLADE_LIBS@ @GNUNET_LIBS@ \ 19 @GLADE_LIBS@ @GNUNET_LIBS@ \
20 -lgnunetutil -lgnunetpeerinfo -lgnunetcore -lgnunettransport \ 20 -lgnunetutil -lgnunetpeerinfo -lgnunetcore -lgnunettransport -lgnunetats \
21 $(INTLLIBS) 21 $(INTLLIBS)
22gnunet_peerinfo_gtk_LDFLAGS = \ 22gnunet_peerinfo_gtk_LDFLAGS = \
23 -export-dynamic \ No newline at end of file 23 -export-dynamic \ No newline at end of file
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c
index 286a8895..13b820eb 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -108,7 +108,7 @@ static struct GNUNET_PEERINFO_NotifyContext *pnc;
108/** 108/**
109 * Handle to ATS service. 109 * Handle to ATS service.
110 */ 110 */
111// static struct GNUNET_ATS_Handle *ats; 111static struct GNUNET_ATS_PerformanceHandle *ats;
112 112
113/** 113/**
114 * Map of peer identities to the respective PeerInfo for our view. 114 * Map of peer identities to the respective PeerInfo for our view.
@@ -185,13 +185,11 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
185{ 185{
186 GNUNET_PEERINFO_notify_cancel (pnc); 186 GNUNET_PEERINFO_notify_cancel (pnc);
187 pnc = NULL; 187 pnc = NULL;
188#if FIXME
189 if (NULL != ats) 188 if (NULL != ats)
190 { 189 {
191 GNUNET_ATS_disconnect (ats); 190 GNUNET_ATS_performance_done (ats);
192 ats = NULL; 191 ats = NULL;
193 } 192 }
194#endif
195 GNUNET_CONTAINER_multihashmap_iterate (peer2info, &free_paths, NULL); 193 GNUNET_CONTAINER_multihashmap_iterate (peer2info, &free_paths, NULL);
196 GNUNET_CONTAINER_multihashmap_destroy (peer2info); 194 GNUNET_CONTAINER_multihashmap_destroy (peer2info);
197 peer2info = NULL; 195 peer2info = NULL;
@@ -248,8 +246,12 @@ peer_address_string_cb (void *cls, const char *address)
248 if ('.' == *dot) 246 if ('.' == *dot)
249 country = GNUNET_strndup (&dot[1], (colon - dot) - 1); 247 country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
250 } 248 }
251 gtk_list_store_set (ls, &iter, 1, 1, 2, country, 3, 249 gtk_list_store_set (ls, &iter,
252 GNUNET_PEERINFO_GTK_get_flag (country), 6, address, -1); 250 PEERINFO_MC_NUMBER_OF_ADDRESSES, 1,
251 PEERINFO_MC_COUNTRY_NAME, country,
252 PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag (country),
253 PEERINFO_MC_ADDRESS_AS_STRING, address,
254 -1);
253 GNUNET_free (country); 255 GNUNET_free (country);
254 } 256 }
255} 257}
@@ -362,32 +364,31 @@ peerinfo_processor (void *cls, const struct GNUNET_PeerIdentity *peer,
362} 364}
363 365
364 366
365#if FIXME
366/** 367/**
367 * Method called whenever a given peer has a status change. 368 * Method called whenever a given peer has a QoS status change.
368 * 369 *
369 * @param cls closure 370 * @param cls closure
370 * @param peer peer identity this notification is about 371 * @param address the address
371 * @param timeout absolute time when this peer will time out
372 * unless we see some further activity from it
373 * @param bandwidth_in available amount of inbound bandwidth 372 * @param bandwidth_in available amount of inbound bandwidth
374 * @param bandwidth_out available amount of outbound bandwidth 373 * @param bandwidth_out available amount of outbound bandwidth
375 * @param atsi performance data for the connection 374 * @param ats performance data for the address (as far as known)
375 * @param ats_count number of performance records in 'ats'
376 */ 376 */
377static void 377static void
378status_cb (void *cls, const struct GNUNET_PeerIdentity *peer, 378status_cb (void *cls,
379 const struct GNUNET_HELLO_Address *address,
379 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 380 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
380 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 381 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
381 struct GNUNET_TIME_Absolute timeout, 382 const struct GNUNET_ATS_Information *ats,
382 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 383 uint32_t ats_count)
383{ 384{
384 struct PeerInfo *info; 385 struct PeerInfo *info;
385 GtkListStore *ls; 386 GtkListStore *ls;
386 GtkTreeModel *tm; 387 GtkTreeModel *tm;
387 GtkTreeIter iter; 388 GtkTreeIter iter;
388 GtkTreePath *path; 389 GtkTreePath *path;
389 390
390 info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey); 391 info = GNUNET_CONTAINER_multihashmap_get (peer2info, &address->peer.hashPubKey);
391 if (NULL == info) 392 if (NULL == info)
392 return; /* should rarely happen... */ 393 return; /* should rarely happen... */
393 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store")); 394 ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
@@ -401,7 +402,6 @@ status_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
401 PEERINFO_MC_BANDWIDTH_OUT, (guint64) ntohl (bandwidth_out.value__), 402 PEERINFO_MC_BANDWIDTH_OUT, (guint64) ntohl (bandwidth_out.value__),
402 -1); 403 -1);
403} 404}
404#endif
405 405
406 406
407/** 407/**
@@ -443,9 +443,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
443 _("Failed to initialize communication with peerinfo service!\n")); 443 _("Failed to initialize communication with peerinfo service!\n"));
444 exit (1); 444 exit (1);
445 } 445 }
446#if FIXME 446 ats = GNUNET_ATS_performance_init (get_configuration (), &status_cb, NULL);
447 ats = GNUNET_ATS_connect (get_configuration (), &status_cb, NULL);
448#endif
449 /* setup main window */ 447 /* setup main window */
450 main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window")); 448 main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
451 gtk_window_maximize (GTK_WINDOW (main_window)); 449 gtk_window_maximize (GTK_WINDOW (main_window));