gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20426 - gnunet-gtk/src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r20426 - gnunet-gtk/src/peerinfo
Date: Sat, 10 Mar 2012 21:48:06 +0100

Author: grothoff
Date: 2012-03-10 21:48:06 +0100 (Sat, 10 Mar 2012)
New Revision: 20426

Modified:
   gnunet-gtk/src/peerinfo/Makefile.am
   gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
Log:
-integrating gnunet-peerinfo-gtk with ATS performance API

Modified: gnunet-gtk/src/peerinfo/Makefile.am
===================================================================
--- gnunet-gtk/src/peerinfo/Makefile.am 2012-03-10 19:10:37 UTC (rev 20425)
+++ gnunet-gtk/src/peerinfo/Makefile.am 2012-03-10 20:48:06 UTC (rev 20426)
@@ -17,7 +17,7 @@
   $(top_builddir)/src/lib/libgnunetgtk.la \
   @GTK_LIBS@ \
   @GLADE_LIBS@ @GNUNET_LIBS@ \
-  -lgnunetutil -lgnunetpeerinfo -lgnunetcore -lgnunettransport \
+  -lgnunetutil -lgnunetpeerinfo -lgnunetcore -lgnunettransport -lgnunetats \
   $(INTLLIBS) 
 gnunet_peerinfo_gtk_LDFLAGS = \
   -export-dynamic 
\ No newline at end of file

Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c       2012-03-10 19:10:37 UTC 
(rev 20425)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c       2012-03-10 20:48:06 UTC 
(rev 20426)
@@ -108,7 +108,7 @@
 /**
  * Handle to ATS service.
  */
-// static struct GNUNET_ATS_Handle *ats;
+static struct GNUNET_ATS_PerformanceHandle *ats;
 
 /**
  * Map of peer identities to the respective PeerInfo for our view.
@@ -185,13 +185,11 @@
 {
   GNUNET_PEERINFO_notify_cancel (pnc);
   pnc = NULL;
-#if FIXME
   if (NULL != ats)
   {
-    GNUNET_ATS_disconnect (ats);
+    GNUNET_ATS_performance_done (ats);
     ats = NULL;
   }
-#endif
   GNUNET_CONTAINER_multihashmap_iterate (peer2info, &free_paths, NULL);
   GNUNET_CONTAINER_multihashmap_destroy (peer2info);
   peer2info = NULL;
@@ -248,8 +246,12 @@
       if ('.' == *dot)
         country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
     }
-    gtk_list_store_set (ls, &iter, 1, 1, 2, country, 3,
-                        GNUNET_PEERINFO_GTK_get_flag (country), 6, address, 
-1);
+    gtk_list_store_set (ls, &iter, 
+                       PEERINFO_MC_NUMBER_OF_ADDRESSES, 1,
+                       PEERINFO_MC_COUNTRY_NAME, country, 
+                       PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag 
(country), 
+                       PEERINFO_MC_ADDRESS_AS_STRING, address, 
+                       -1);
     GNUNET_free (country);
   }
 }
@@ -362,32 +364,31 @@
 }
 
 
-#if FIXME
 /**
- * Method called whenever a given peer has a status change.
+ * Method called whenever a given peer has a QoS status change.
  *
  * @param cls closure
- * @param peer peer identity this notification is about
- * @param timeout absolute time when this peer will time out
- *        unless we see some further activity from it
+ * @param address the address
  * @param bandwidth_in available amount of inbound bandwidth
  * @param bandwidth_out available amount of outbound bandwidth
- * @param atsi performance data for the connection
+ * @param ats performance data for the address (as far as known)
+ * @param ats_count number of performance records in 'ats'
  */
 static void
-status_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
+status_cb (void *cls, 
+          const struct GNUNET_HELLO_Address *address,
            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-           struct GNUNET_TIME_Absolute timeout,
-           const struct GNUNET_TRANSPORT_ATS_Information *atsi)
+           const struct GNUNET_ATS_Information *ats,
+          uint32_t ats_count)
 {
   struct PeerInfo *info;
   GtkListStore *ls;
   GtkTreeModel *tm;
   GtkTreeIter iter;
   GtkTreePath *path;
-
-  info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey);
+  
+  info = GNUNET_CONTAINER_multihashmap_get (peer2info, 
&address->peer.hashPubKey);
   if (NULL == info)
     return;                     /* should rarely happen... */
   ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
@@ -401,7 +402,6 @@
                      PEERINFO_MC_BANDWIDTH_OUT, (guint64) ntohl 
(bandwidth_out.value__),
                      -1);
 }
-#endif
 
 
 /**
@@ -443,9 +443,7 @@
              _("Failed to initialize communication with peerinfo service!\n"));
     exit (1);
   }
-#if FIXME
-  ats = GNUNET_ATS_connect (get_configuration (), &status_cb, NULL);
-#endif
+  ats = GNUNET_ATS_performance_init (get_configuration (), &status_cb, NULL);
   /* setup main window */
   main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
   gtk_window_maximize (GTK_WINDOW (main_window));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]