Commit 66203b2d authored by Tomas Touceda's avatar Tomas Touceda
Browse files

Use consensus bandwidth when microdescriptors is enabled

Conflicts:

	src/vidalia/network/NetViewer.cpp
parent b61cca2c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -106,4 +106,7 @@ RouterDescriptor::appendRouterStatusInfo(const RouterStatus &rs)
  _ip = rs.ipAddress();
  _orPort = rs.orPort();
  _dirPort = rs.dirPort();
  _avgBandwidth = rs.bandwidth();
  _burstBandwidth = rs.bandwidth();
  _observedBandwidth = rs.bandwidth();
}
+13 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ RouterStatus::RouterStatus(const QStringList &status)
  _valid = false;
  _flags = 0;

  _bandwidth = 0;

  foreach (QString line, status) {
    if (line.startsWith("r ")) {
      QStringList parts = line.split(" ", QString::SkipEmptyParts);
@@ -83,6 +85,17 @@ RouterStatus::RouterStatus(const QStringList &status)
      foreach (QString flag, flags) {
        _flags |= flagValue(flag);
      }
    } else if (line.startsWith("w ")) {
      /* Status flags */
      QStringList parts = line.split(" ", QString::SkipEmptyParts);
      parts.removeFirst(); /* Remove the "w" */

      if(parts.size() > 0) {
        QStringList bw = parts.at(0).split("=", QString::SkipEmptyParts);
        if(bw.size() == 2) {
          _bandwidth = (quint64)bw.at(1).toULongLong();
        }
      }
    }
  }
}
+3 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ public:
  Flags flags() const { return _flags; }
  /** Returns true if this router is currently listed as Running. */
  bool isRunning() const { return (flags() & Running); }
  /** Returns the consensus bandwidth */
  quint64 bandwidth() const { return _bandwidth; }

  /** Returns true if this router status object is valid. This method should
   * be called to verify that the QStringList given in this object's
@@ -89,6 +91,7 @@ private:
  quint16 _orPort;  /**< Current OR port. */
  quint16 _dirPort; /**< Current directory port. */
  Flags _flags;     /**< OR-ed field of the router's current status flags. */
  quint64 _bandwidth; /**< Consensus bandwidth */
};

Q_DECLARE_OPERATORS_FOR_FLAGS(RouterStatus::Flags)
+2 −1
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ void
NetViewer::loadNetworkStatus()
{
  NetworkStatus networkStatus = _torControl->getNetworkStatus();
  
  foreach(RouterStatus rs, networkStatus) {
    if (!rs.isRunning())
      continue;