summaryrefslogtreecommitdiff
path: root/src/uTPCore.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/uTPCore.cc')
-rw-r--r--src/uTPCore.cc34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/uTPCore.cc b/src/uTPCore.cc
index a279ae56..a983676c 100644
--- a/src/uTPCore.cc
+++ b/src/uTPCore.cc
@@ -301,6 +301,34 @@ void uTPCore::closeConnection()
command_ = nullptr;
}
+void uTPCore::setRWCheck(Command* command, int is_add, int is_read)
+{
+ if (is_add == true) {
+ command_ = command;
+ if (is_read == true) {
+ readCheck_ = true;
+ if (isReadable(0)) {
+ command_->setStatusActive();
+ }
+ }
+ else {
+ writeCheck_ = true;
+ if (isWritable(0)) {
+ command_->setStatusActive();
+ }
+ }
+ }
+ else {
+ command_ = command;
+ if (is_read == true) {
+ readCheck_ = false;
+ }
+ else {
+ writeCheck_ = false;
+ }
+ }
+}
+
uTPListenCommand::uTPListenCommand(cuid_t cuid, DownloadEngine* e,
utp_context* ctx,
std::shared_ptr<SocketCore> sock)
@@ -344,10 +372,4 @@ bool uTPListenCommand::execute()
return false;
}
-void uTPCore::SetRWCheck(Command* command, int is_add, int is_read)
-{
- command_ = command;
- (is_read ? readCheck_ : writeCheck_) = is_add;
-}
-
} // namespace aria2