summaryrefslogtreecommitdiff
path: root/src/ActivePeerConnectionCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-05 16:01:46 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-05 16:01:46 +0000
commit4db349c1f32b4a313d12d114137432441633d00a (patch)
tree417451971e264834312cfd8339c79930d680a5d1 /src/ActivePeerConnectionCommand.cc
parent338e8aca09331d3e7fa4e1e8e1f9d10260986772 (diff)
2010-01-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Untabify. Fixed one line in copyright which is longer than 80 columns. * src * test
Diffstat (limited to 'src/ActivePeerConnectionCommand.cc')
-rw-r--r--src/ActivePeerConnectionCommand.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc
index 24ec1efd..cb53e14a 100644
--- a/src/ActivePeerConnectionCommand.cc
+++ b/src/ActivePeerConnectionCommand.cc
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
@@ -86,7 +86,7 @@ bool ActivePeerConnectionCommand::execute() {
if(_requestGroup->getDownloadContext()->
getAttribute(bittorrent::BITTORRENT).containsKey(bittorrent::METADATA)) {
thresholdSpeed =
- _requestGroup->getOption()->getAsInt(PREF_BT_REQUEST_PEER_SPEED_LIMIT);
+ _requestGroup->getOption()->getAsInt(PREF_BT_REQUEST_PEER_SPEED_LIMIT);
} else {
thresholdSpeed = 0;
}
@@ -95,31 +95,31 @@ bool ActivePeerConnectionCommand::execute() {
}
if(// for seeder state
(_pieceStorage->downloadFinished() && _btRuntime->lessThanMaxPeers() &&
- (maxUploadLimit == 0 || tstat.getUploadSpeed() < maxUploadLimit*0.8)) ||
+ (maxUploadLimit == 0 || tstat.getUploadSpeed() < maxUploadLimit*0.8)) ||
// for leecher state
(!_pieceStorage->downloadFinished() &&
- (tstat.getDownloadSpeed() < thresholdSpeed ||
- _btRuntime->lessThanMinPeers()))) {
+ (tstat.getDownloadSpeed() < thresholdSpeed ||
+ _btRuntime->lessThanMinPeers()))) {
unsigned int numConnection = 0;
if(_pieceStorage->downloadFinished()) {
- if(_btRuntime->getMaxPeers() > _btRuntime->getConnections()) {
- numConnection =
- std::min(_numNewConnection,
- _btRuntime->getMaxPeers()-_btRuntime->getConnections());
- }
+ if(_btRuntime->getMaxPeers() > _btRuntime->getConnections()) {
+ numConnection =
+ std::min(_numNewConnection,
+ _btRuntime->getMaxPeers()-_btRuntime->getConnections());
+ }
} else {
- numConnection = _numNewConnection;
+ numConnection = _numNewConnection;
}
for(unsigned int numAdd = numConnection;
- numAdd > 0 && _peerStorage->isPeerAvailable(); --numAdd) {
- PeerHandle peer = _peerStorage->getUnusedPeer();
- connectToPeer(peer);
+ numAdd > 0 && _peerStorage->isPeerAvailable(); --numAdd) {
+ PeerHandle peer = _peerStorage->getUnusedPeer();
+ connectToPeer(peer);
}
if(_btRuntime->getConnections() == 0 &&
- !_pieceStorage->downloadFinished()) {
- _btAnnounce->overrideMinInterval(BtAnnounce::DEFAULT_ANNOUNCE_INTERVAL);
+ !_pieceStorage->downloadFinished()) {
+ _btAnnounce->overrideMinInterval(BtAnnounce::DEFAULT_ANNOUNCE_INTERVAL);
}
}
}
@@ -135,12 +135,12 @@ void ActivePeerConnectionCommand::connectToPeer(const PeerHandle& peer)
peer->usedBy(e->newCUID());
PeerInitiateConnectionCommand* command =
new PeerInitiateConnectionCommand(peer->usedBy(), _requestGroup, peer, e,
- _btRuntime);
+ _btRuntime);
command->setPeerStorage(_peerStorage);
command->setPieceStorage(_pieceStorage);
e->commands.push_back(command);
logger->info(MSG_CONNECTING_TO_PEER,
- cuid, peer->ipaddr.c_str());
+ cuid, peer->ipaddr.c_str());
}
void ActivePeerConnectionCommand::setBtRuntime