diff --git a/ChangeLog b/ChangeLog index 3a54dbff..a85759bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-05-15 Tatsuhiro Tsujikawa + + Added changeGlobalOption command. Currently, + max-overall-download-limit and max-overall-upload-limit option are + available. + * src/RequestGroupMan.h + * src/XmlRpcMethod.cc + * src/XmlRpcMethod.h + * src/XmlRpcMethodFactory.cc + * src/XmlRpcMethodImpl.cc + * src/XmlRpcMethodImpl.h + * test/XmlRpcMethodTest.cc + 2009-05-15 Tatsuhiro Tsujikawa Added changeOption command. Currently, max-download-limit, diff --git a/src/RequestGroupMan.h b/src/RequestGroupMan.h index 2c2629f3..d181fb5d 100644 --- a/src/RequestGroupMan.h +++ b/src/RequestGroupMan.h @@ -193,10 +193,30 @@ public: // _maxOverallDownloadSpeedLimit == 0. Otherwise returns false. bool doesOverallDownloadSpeedExceed(); + void setMaxOverallDownloadSpeedLimit(unsigned int speed) + { + _maxOverallDownloadSpeedLimit = speed; + } + + unsigned int getMaxOverallDownloadSpeedLimit() const + { + return _maxOverallDownloadSpeedLimit; + } + // Returns true if current upload speed exceeds // _maxOverallUploadSpeedLimit. Always returns false if // _maxOverallUploadSpeedLimit == 0. Otherwise returns false. bool doesOverallUploadSpeedExceed(); + + void setMaxOverallUploadSpeedLimit(unsigned int speed) + { + _maxOverallUploadSpeedLimit = speed; + } + + unsigned int getMaxOverallUploadSpeedLimit() const + { + return _maxOverallUploadSpeedLimit; + } }; typedef SharedHandle RequestGroupManHandle; diff --git a/src/XmlRpcMethod.cc b/src/XmlRpcMethod.cc index 145dc9a1..5200933f 100644 --- a/src/XmlRpcMethod.cc +++ b/src/XmlRpcMethod.cc @@ -115,7 +115,7 @@ const std::vector& listChangeableOptions() PREF_MAX_DOWNLOAD_LIMIT, }; static std::vector options - (&OPTIONS[0], &OPTIONS[arrayLength(OPTIONS)]);; + (&OPTIONS[0], &OPTIONS[arrayLength(OPTIONS)]); return options; } @@ -126,6 +126,25 @@ void XmlRpcMethod::gatherChangeableOption option, optionsDict, _optionParser); } +const std::vector& listChangeableGlobalOptions() +{ + static const std::string OPTIONS[] = { + PREF_MAX_OVERALL_UPLOAD_LIMIT, + PREF_MAX_OVERALL_DOWNLOAD_LIMIT, + }; + static std::vector options + (&OPTIONS[0], &OPTIONS[arrayLength(OPTIONS)]); + return options; +} + +void XmlRpcMethod::gatherChangeableGlobalOption +(const SharedHandle