+void TorrentSession::setOptions(qtrapids::ParamsMap_t options)
+{
+ qtrapids::ParamsMapConstIterator_t end = options.end();
+ qtrapids::ParamsMapConstIterator_t tmpIter = options.find("net/downloadRate");
+ int rate = -1;
+
+ // Apply settings immediately to Bittorrent session:
+ // NOTE: QHash interface is not quite STL-like
+
+ if (tmpIter != end) {
+ rate = tmpIter.value().toInt();
+ btSession_.set_download_rate_limit(rate);
+ }
+
+ tmpIter = options.find("net/uploadRate");
+ if (tmpIter != end) {
+ rate = tmpIter.value().toInt();
+ btSession_.set_upload_rate_limit(rate);
+ }
+
+ /// @todo Add more immediately applicable settings here, if needed.
+
+ // Finally, save settings to persistent storage:
+ settings_->setOptions(options);
+}
+
+
+qtrapids::ParamsMap_t TorrentSession::getOptions()
+{
+ return settings_->getOptions();
+}
+
+
+void TorrentSession::terminateSession()
+{
+ qDebug() << "Terminate called";
+ // Emiting terminate() here causes the server application to quit in main()
+ emit terminate();
+}
+