From 113c8fac7f175db8a415c368ceefd62428d45967 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 16 Mar 2007 14:21:29 +0000 Subject: 2007-03-16 Tatsuhiro Tsujikawa To reduce overhead to find commands whose socket is either readable or writable in the download engine loop: * src/Command.h, src/Command.cc (STATUS): New enum. (status): New variable. (statusMatch): New function. (setStatusActive): New function. (setStatusInactive): New function. * src/DownloadEngine.h, src/DownloadEngine.cc (executeCommand): New function. (run): Simplified. (waitData): Call Command::setStatusActive() when command's socket is readable or writable. --- src/Command.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Command.cc') diff --git a/src/Command.cc b/src/Command.cc index 7f701883..de53c59a 100644 --- a/src/Command.cc +++ b/src/Command.cc @@ -35,3 +35,14 @@ #include "Command.h" int Command::uuidGen = 0; + +bool Command::statusMatch(Command::STATUS statusFilter) const +{ + if(statusFilter == STATUS_ALL) { + return true; + } else if(statusFilter == status) { + return true; + } else { + return false; + } +} -- cgit