Enable write socket check when there is pending messages to send

pull/675/head
Tatsuhiro Tsujikawa 2016-06-05 11:26:41 +09:00
parent 93bd6cfbb8
commit 5ec84f9eae
1 changed files with 7 additions and 10 deletions

View File

@ -340,19 +340,11 @@ bool PeerInteractionCommand::executeInternal()
break; break;
} }
case WIRED: case WIRED:
// See the comment for writable check below.
disableWriteCheckSocket();
btInteractive_->doInteractionProcessing(); btInteractive_->doInteractionProcessing();
if (btInteractive_->countReceivedMessageInIteration() > 0) { if (btInteractive_->countReceivedMessageInIteration() > 0) {
updateKeepAlive(); updateKeepAlive();
} }
// Writable check to avoid slow seeding
if (btInteractive_->isSendingMessageInProgress()) {
setWriteCheckSocket(getSocket());
}
if (getDownloadEngine() if (getDownloadEngine()
->getRequestGroupMan() ->getRequestGroupMan()
->doesOverallDownloadSpeedExceed() || ->doesOverallDownloadSpeedExceed() ||
@ -368,9 +360,14 @@ bool PeerInteractionCommand::executeInternal()
break; break;
} }
} }
if (btInteractive_->countPendingMessage() > 0) { if (btInteractive_->countPendingMessage() > 0 ||
setNoCheck(true); btInteractive_->isSendingMessageInProgress()) {
setWriteCheckSocket(getSocket());
} }
else {
disableWriteCheckSocket();
}
addCommandSelf(); addCommandSelf();
return false; return false;
} }