Fixed configuration initialization of filer
This commit is contained in:
@@ -35,10 +35,15 @@ public:
|
|||||||
logger->print(LOGLEVEL_ERROR, "No filer factory available");
|
logger->print(LOGLEVEL_ERROR, "No filer factory available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
filer = default_filer_factory();
|
this->setupFiler();
|
||||||
submit(230, conf_format(server_name, (std::map<std::string, std::string>){{std::string(APPNAME_VAR),std::string(APPNAME)},{std::string(VERSION_VAR),std::string(VERSION)}}));
|
submit(230, conf_format(server_name, (std::map<std::string, std::string>){{std::string(APPNAME_VAR),std::string(APPNAME)},{std::string(VERSION_VAR),std::string(VERSION)}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupFiler() {
|
||||||
|
filer = default_filer_factory();
|
||||||
|
filer->initialize(config->get(default_filer_name)->get());
|
||||||
|
}
|
||||||
|
|
||||||
int receive(std::string cmd, std::string argstr) {
|
int receive(std::string cmd, std::string argstr) {
|
||||||
if (control_sock <= 0) return 1;
|
if (control_sock <= 0) return 1;
|
||||||
|
|
||||||
@@ -91,7 +96,7 @@ public:
|
|||||||
} else if (cmd == "REIN") {
|
} else if (cmd == "REIN") {
|
||||||
if (state == FTP_STATE_ONDATA) data_close();
|
if (state == FTP_STATE_ONDATA) data_close();
|
||||||
auth_data = new ClientAuthDetails{};
|
auth_data = new ClientAuthDetails{};
|
||||||
filer = default_filer_factory();
|
this->setupFiler();
|
||||||
// Reset features
|
// Reset features
|
||||||
for (const auto &x : features)
|
for (const auto &x : features)
|
||||||
features[x.first] = "OFF";
|
features[x.first] = "OFF";
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ void initializePlugins() {
|
|||||||
|
|
||||||
// Initialize filer
|
// Initialize filer
|
||||||
std::string filer_type = config->getValue("engines", "filer", "local");
|
std::string filer_type = config->getValue("engines", "filer", "local");
|
||||||
|
default_filer_name = filer_type;
|
||||||
default_filer_factory = filer_manager.getFactory(filer_type);
|
default_filer_factory = filer_manager.getFactory(filer_type);
|
||||||
|
|
||||||
if (!default_filer_factory) {
|
if (!default_filer_factory) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ std::string motd;
|
|||||||
ConfigFile* config;
|
ConfigFile* config;
|
||||||
Auth* auth;
|
Auth* auth;
|
||||||
Logger* logger;
|
Logger* logger;
|
||||||
|
static std::string default_filer_name;
|
||||||
static typename PluginTraits<Filer>::CreateFunc default_filer_factory = nullptr;
|
static typename PluginTraits<Filer>::CreateFunc default_filer_factory = nullptr;
|
||||||
bool runServer;
|
bool runServer;
|
||||||
bool runCompression;
|
bool runCompression;
|
||||||
|
|||||||
Reference in New Issue
Block a user