Browse Source

More experimentation with multicast rate.

Adam Ierymenko 12 years ago
parent
commit
07e1085dcc
2 changed files with 12 additions and 0 deletions
  1. 9 0
      node/BandwidthAccount.hpp
  2. 3 0
      node/Network.hpp

+ 9 - 0
node/BandwidthAccount.hpp

@@ -121,6 +121,15 @@ public:
 		return false;
 	}
 
+	/**
+	 * @return Most recent balance without update
+	 */
+	inline uint32_t balance() const
+		throw()
+	{
+		return _balance;
+	}
+
 private:
 	double _lastTime;
 	uint32_t _balance;

+ 3 - 0
node/Network.hpp

@@ -581,6 +581,9 @@ public:
 			bal = _multicastRateAccounts.insert(std::pair< std::pair<Address,MulticastGroup>,BandwidthAccount >(k,BandwidthAccount(r.preload,r.maxBalance,r.accrual))).first;
 		}
 		return bal->second.deduct(bytes);
+		//bool tmp = bal->second.deduct(bytes);
+		//printf("%s: BAL: %u\n",mg.toString().c_str(),(unsigned int)bal->second.balance());
+		//return tmp;
 	}
 
 private: