mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-01-03 07:09:59 +01:00
remove smart pointer of ftp server
This commit is contained in:
parent
1f7f56ecfa
commit
bfa7b5467d
|
|
@ -13,30 +13,29 @@ FTPTask::~FTPTask() {
|
|||
}
|
||||
|
||||
bool FTPTask::setup(System &system) {
|
||||
_ftpServer = std::shared_ptr<FTPServer>(new FTPServer());
|
||||
for (Configuration::Ftp::User user : system.getUserConfig()->ftp.users) {
|
||||
logPrintD("Adding user to FTP Server: ");
|
||||
logPrintlnD(user.name);
|
||||
_ftpServer->addUser(user.name, user.password);
|
||||
_ftpServer.addUser(user.name, user.password);
|
||||
}
|
||||
_ftpServer->addFilesystem("SPIFFS", &SPIFFS);
|
||||
_ftpServer.addFilesystem("SPIFFS", &SPIFFS);
|
||||
_stateInfo = "waiting";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FTPTask::loop(System &system) {
|
||||
if (!_beginCalled) {
|
||||
_ftpServer->begin();
|
||||
_ftpServer.begin();
|
||||
_beginCalled = true;
|
||||
}
|
||||
_ftpServer->handle();
|
||||
_ftpServer.handle();
|
||||
static bool configWasOpen = false;
|
||||
if (configWasOpen && _ftpServer->countConnections() == 0) {
|
||||
if (configWasOpen && _ftpServer.countConnections() == 0) {
|
||||
logPrintlnW("Maybe the config has been changed via FTP, lets restart now to get the new config...");
|
||||
logPrintlnW("");
|
||||
ESP.restart();
|
||||
}
|
||||
if (_ftpServer->countConnections() > 0) {
|
||||
if (_ftpServer.countConnections() > 0) {
|
||||
configWasOpen = true;
|
||||
_stateInfo = "has connection";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ public:
|
|||
virtual bool loop(System &system) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<FTPServer> _ftpServer;
|
||||
bool _beginCalled;
|
||||
FTPServer _ftpServer;
|
||||
bool _beginCalled;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue