From dfe3b9bf15fcc579c7f5414939e568e5e4b2104e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 31 Jul 2008 15:25:23 +0000 Subject: [PATCH] 2008-08-01 Tatsuhiro Tsujikawa Removed writable check when socket's send buffer is full in BitTorrent downloads to lower CPU usage. * src/PeerInteractionCommand.cc --- ChangeLog | 6 ++++++ src/PeerInteractionCommand.cc | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 826a4cfd..c6a849ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-01 Tatsuhiro Tsujikawa + + Removed writable check when socket's send buffer is full in BitTorrent + downloads to lower CPU usage. + * src/PeerInteractionCommand.cc + 2008-07-31 Tatsuhiro Tsujikawa Fixed broken gzip inflation. diff --git a/src/PeerInteractionCommand.cc b/src/PeerInteractionCommand.cc index 89ef1d0c..c098b41e 100644 --- a/src/PeerInteractionCommand.cc +++ b/src/PeerInteractionCommand.cc @@ -223,7 +223,8 @@ bool PeerInteractionCommand::executeInternal() { break; } case WIRED: - disableWriteCheckSocket(); + // See the comment for writable check below. + // disableWriteCheckSocket(); btInteractive->doInteractionProcessing(); if(btInteractive->countReceivedMessageInIteration() > 0) { updateKeepAlive(); @@ -231,9 +232,11 @@ bool PeerInteractionCommand::executeInternal() { if((peer->amInterested() && !peer->peerChoking() && (peer->getLatency() < 1500)) || (peer->peerInterested() && !peer->amChoking())) { - if(btInteractive->isSendingMessageInProgress()) { - setWriteCheckSocket(socket); - } + // Writable check causes CPU usage high because socket becomes writable + // instantly. So don't do it. + // if(btInteractive->isSendingMessageInProgress()) { + // setWriteCheckSocket(socket); + // } if(maxDownloadSpeedLimit > 0) { TransferStat stat = peerStorage->calculateStat();