[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2739: Large update. Removed hardcoded consts (QT fu is good). Remo (in vidalia/branches/exit-country/src/vidalia: . config network)



Author: cviecco
Date: 2008-06-16 11:37:15 -0400 (Mon, 16 Jun 2008)
New Revision: 2739

Removed:
   vidalia/branches/exit-country/src/vidalia/network/geoipcache.cpp
   vidalia/branches/exit-country/src/vidalia/network/geoipcache.h
   vidalia/branches/exit-country/src/vidalia/network/geoipcacheitem.cpp
   vidalia/branches/exit-country/src/vidalia/network/geoipcacheitem.h
   vidalia/branches/exit-country/src/vidalia/network/geoiprequest.cpp
   vidalia/branches/exit-country/src/vidalia/network/geoiprequest.h
   vidalia/branches/exit-country/src/vidalia/network/geoipresolver.cpp
   vidalia/branches/exit-country/src/vidalia/network/geoipresolver.h
   vidalia/branches/exit-country/src/vidalia/network/geoipresponse.cpp
   vidalia/branches/exit-country/src/vidalia/network/geoipresponse.h
Modified:
   vidalia/branches/exit-country/src/vidalia/CMakeLists.txt
   vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp
   vidalia/branches/exit-country/src/vidalia/network/netviewer.cpp
   vidalia/branches/exit-country/src/vidalia/network/netviewer.h
Log:
Large update. Removed hardcoded consts (QT fu is good). Removed files no longer necesary due to use of internal DB.Removed dependencies on such files from netviewer. Updated CMakeLists to avoid those files.


Modified: vidalia/branches/exit-country/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/branches/exit-country/src/vidalia/CMakeLists.txt	2008-06-16 14:29:44 UTC (rev 2738)
+++ vidalia/branches/exit-country/src/vidalia/CMakeLists.txt	2008-06-16 15:37:15 UTC (rev 2739)
@@ -133,12 +133,12 @@
 set(vidalia_SRCS ${vidalia_SRCS}
   network/circuititem.cpp
   network/circuitlistwidget.cpp
-  network/geoipcache.cpp
-  network/geoipcacheitem.cpp
+  #network/geoipcache.cpp
+  #network/geoipcacheitem.cpp
   #network/geoip.cpp
-  network/geoiprequest.cpp
-  network/geoipresolver.cpp
-  network/geoipresponse.cpp
+  #network/geoiprequest.cpp
+  #network/geoipresolver.cpp
+  #network/geoipresponse.cpp
   network/netviewer.cpp
   network/routerdescriptorview.cpp
   network/routerlistitem.cpp
@@ -149,7 +149,7 @@
 )
 qt4_wrap_cpp(vidalia_SRCS
   network/circuitlistwidget.h
-  network/geoipresolver.h
+  #network/geoipresolver.h
   network/netviewer.h
   network/routerdescriptorview.h
   network/routerlistwidget.h

Modified: vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp
===================================================================
--- vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp	2008-06-16 14:29:44 UTC (rev 2738)
+++ vidalia/branches/exit-country/src/vidalia/config/networkoutpage.cpp	2008-06-16 15:37:15 UTC (rev 2739)
@@ -189,17 +189,16 @@
      if (!router.isValid())
       continue;
      flags=router.flags();
-     if(0x0408 !=((0x08 | 0x02 | 0x0400) & flags) )  //must be exit,valid and not badexit!
+     //check for exit and badexit
+     if((router.Exit) !=((router.Exit | router.BadExit) & flags) ) 
       continue;
-     //fprintf(stderr,"%x\n",flags);
 
      /*Get a unique name, if unnamed use the full descriptor id*/
      uniqueRouterName=router.name();
-     
-     //Since I dont know a way to determine if a router name is registered 
-     // Will use FULL id for now.. This really sucks
-     // I am wrongly assuming here that stable,guard nodes are registered!
-     if(uniqueRouterName=="Unnamed" || (0x00== (flags & 0x80))){
+    
+     //display names only for registered nodes, this to avoid warnings
+     // on tor and assure name uniquness
+     if(uniqueRouterName=="Unnamed" || (0x00== (flags & router.Named))){
          uniqueRouterName=router.id().prepend("$");
      }
 
@@ -209,7 +208,6 @@
                  QStringList(by_country_exit_nodes.value(short_country_name))<<uniqueRouterName);
      }
      else{
-        //by_country_exit_nodes.insert(short_country_name,QStringList()<<router.name());
         by_country_exit_nodes.insert(short_country_name,QStringList()<<uniqueRouterName);
 
      }

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipcache.cpp

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipcache.h

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipcacheitem.cpp

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipcacheitem.h

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoiprequest.cpp

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoiprequest.h

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipresolver.cpp

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipresolver.h

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipresponse.cpp

Deleted: vidalia/branches/exit-country/src/vidalia/network/geoipresponse.h

Modified: vidalia/branches/exit-country/src/vidalia/network/netviewer.cpp
===================================================================
--- vidalia/branches/exit-country/src/vidalia/network/netviewer.cpp	2008-06-16 14:29:44 UTC (rev 2738)
+++ vidalia/branches/exit-country/src/vidalia/network/netviewer.cpp	2008-06-16 15:37:15 UTC (rev 2739)
@@ -109,8 +109,8 @@
   connect(_torControl, SIGNAL(disconnected()), this, SLOT(onDisconnected())); 
 
   /* Connect the slot to find out when geoip information has arrived */
-  connect(&_geoip, SIGNAL(resolved(int, QList<GeoIp>)), 
-             this,   SLOT(resolved(int, QList<GeoIp>)));
+  //connect(&_geoip, SIGNAL(resolved(int, QList<GeoIp>)), 
+  //           this,   SLOT(resolved(int, QList<GeoIp>)));
 
   //file based geoip resolver
   _geoIpResolver=Vidalia::geoIpResolver();
@@ -134,8 +134,8 @@
 void
 NetViewer::onAuthenticated()
 {
-  _geoip.setSocksHost(_torControl->getSocksAddress(),
-                      _torControl->getSocksPort());
+  //_geoip.setSocksHost(_torControl->getSocksAddress(),
+  //                    _torControl->getSocksPort());
   refresh();
   _refreshTimer.start();
   ui.actionRefresh->setEnabled(true);
@@ -318,8 +318,8 @@
   router = ui.treeRouterList->findRouterById(rd.id());
   GeoIp geoip=_geoIpResolver->search(rd.ip());
   router->setLocation(geoip );
-        // Plot the router on the map 
-         _map->addRouter(router->id(), geoip.latitude(), geoip.longitude());
+  // Plot the router on the map 
+  _map->addRouter(router->id(), geoip.latitude(), geoip.longitude());
 
 
 }
@@ -337,32 +337,6 @@
   }
 }
 
-/** Adds an IP address to the resolve queue and updates the queue timers. */
-void
-NetViewer::addToResolveQueue(QHostAddress ip, QString id)
-{
-  QString ipstr = ip.toString();
-  if (!_resolveMap.values(ipstr).contains(id)) {
-    /* Remember which server ids belong to which IP addresses */
-    _resolveMap.insertMulti(ipstr, id);
-  }
- 
-  if (!_resolveQueue.contains(ip) && !_geoip.resolveFromCache(ip)) {
-    /* Add the IP to the queue of IPs waiting for geographic information  */
-    _resolveQueue << ip;
- 
-    /* Wait MIN_RESOLVE_QUEUE_DELAY after the last item inserted into the
-     * queue, before sending the resolve request. */
-    _minResolveQueueTimer.start(MIN_RESOLVE_QUEUE_DELAY);
-    
-    /* Do not wait longer than MAX_RESOLVE_QUEUE_DELAY from the time the first
-     * item is inserted into the queue, before flushing and resolving the
-     * queue. */
-    if (_resolveQueue.size() == 1) {
-      _maxResolveQueueTimer.start(MAX_RESOLVE_QUEUE_DELAY);
-    }
-  }
-}
 
 /** Called when the user selects a circuit from the circuit and streams
  * list. */
@@ -400,63 +374,15 @@
 }
 
 /** If there are any IPs in the resolve queue, do the request now. */
-void
-NetViewer::resolve()
-{
-  if (!_resolveQueue.isEmpty()) {
-    /* Send the request now if either the network map is visible, or the
-     * request is for more than a quarter of the servers in the list. */
-    if (isVisible() || 
-        (_resolveQueue.size() >= ui.treeRouterList->topLevelItemCount()/4)) {
-      vInfo("Sending GeoIP request for %1 IP addresses.")
-                               .arg(_resolveQueue.size());
-      /* Flush the resolve queue and stop the timers */
-      _geoip.resolve(_resolveQueue);
-      _resolveQueue.clear();
-    }
-  }
-  /* Stop the queue timers. Only one should be active since the other is what
-   * called this slot, but calling stop() on a stopped timer does not hurt. */
-  _minResolveQueueTimer.stop();
-  _maxResolveQueueTimer.stop();
-}
+//void
+//NetViewer::resolve()
+//{
+//}
 
 /** Called when a list of GeoIp information has been resolved. */
-void
-NetViewer::resolved(int id, QList<GeoIp> geoips)
-{
-  Q_UNUSED(id);
-  QString ip;
-  RouterListItem *router;
+//void
+//NetViewer::resolved(int id, QList<GeoIp> geoips)
+//{
+//  _map->update();
+//}
 
-  fprintf(stderr,"resolved!"); 
-  foreach (GeoIp geoip, geoips) {
-    /* Find all routers that are at this IP address */
-    ip = geoip.ip().toString();
-    QList<QString> ids = _resolveMap.values(ip);
-    _resolveMap.remove(ip);
-    if (geoip.isUnknown())
-      continue; /* We don't know where this router is */
-      
-    /* Update their geographic location information with the results of this
-     * GeoIP query. */
-    foreach (QString id, ids) {
-      router = ui.treeRouterList->findRouterById(id);
-      if (router) {
-        /* Save the location information in the descriptor */
-        router->setLocation(geoip);
-        /* Plot the router on the map */
-        _map->addRouter(router->id(), geoip.latitude(), geoip.longitude());
-      }
-    }
-  }
-
-  /* Update the circuit lines */
-  foreach (Circuit circuit, ui.treeCircuitList->circuits()) {
-    _map->addCircuit(circuit.id(), circuit.routerIDs());
-  }
-
-  /* Repaint the map */
-  _map->update();
-}
-

Modified: vidalia/branches/exit-country/src/vidalia/network/netviewer.h
===================================================================
--- vidalia/branches/exit-country/src/vidalia/network/netviewer.h	2008-06-16 14:29:44 UTC (rev 2738)
+++ vidalia/branches/exit-country/src/vidalia/network/netviewer.h	2008-06-16 15:37:15 UTC (rev 2739)
@@ -26,7 +26,7 @@
 #include <vidaliawindow.h>
 #include <filegeoipresolver.h>
 
-#include "geoipresolver.h"
+//#include "geoipresolver.h"
 #include "tormapwidget.h"
 #include "ui_netviewer.h"
 
@@ -65,7 +65,7 @@
   /** Called when the user selects a circuit on the circuit list */
   void circuitSelected(Circuit circuit);
   /** Called when an IP has been resolved to geographic information. */
-  void resolved(int id, QList<GeoIp> geoips);
+  //void resolved(int id, QList<GeoIp> geoips);
   /** Called when the user selects a router in the list. */
   void routerSelected(RouterDescriptor router);
   /** Handles when we get connected to Tor network */
@@ -73,11 +73,11 @@
   /** Handles when we get disconnected from Tor network */
   void onDisconnected();
   /** Resolves IP addresses in the resolve queue to geographic information. */
-  void resolve();
+  //void resolve();
   
 private:
   /** Adds an IP address to the resolve queue and updates the queue timers. */
-  void addToResolveQueue(QHostAddress ip, QString id);
+  //void addToResolveQueue(QHostAddress ip, QString id);
   /** Retrieves a list of all running routers from Tor and their descriptors,
    * and adds them to the RouterListWidget. */
   void loadNetworkStatus();
@@ -98,7 +98,7 @@
   /** TorMapWidget that displays the map. */
   TorMapWidget* _map;
   /** GeoIpResolver used to geolocate routers by IP address. */
-  GeoIpResolver _geoip;
+  //GeoIpResolver _geoip;
   /** Queue for IPs pending resolution to geographic information. */
   QList<QHostAddress> _resolveQueue;
   /** Maps pending GeoIP requests to server IDs. */