RequestWorker: take unique ptr (fixes regression)

This commit is contained in:
Albert S. 2019-09-29 21:34:21 +02:00
والد bae6ae73bf
کامیت 9bb1fa5a33
2فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده

مشاهده پرونده

@ -142,7 +142,7 @@ int main(int argc, char **argv)
cache->clear(); cache->clear();
HandlerFactory handlerFactory { config.handlersConfig, siteTemplate, *database.get(), urlProvider, *cache.get()}; HandlerFactory handlerFactory { config.handlersConfig, siteTemplate, *database.get(), urlProvider, *cache.get()};
RequestWorker requestWorker { handlerFactory, *database->createSessionDao().get(), siteTemplate }; RequestWorker requestWorker { handlerFactory, database->createSessionDao(), siteTemplate };
auto interface = createGateway(config); auto interface = createGateway(config);

مشاهده پرونده

@ -17,16 +17,16 @@ class RequestWorker
UrlProvider *urlProvider; UrlProvider *urlProvider;
ICache *cache; ICache *cache;
HandlerFactory *handlerFactory; HandlerFactory *handlerFactory;
SessionDao *sessionDao; std::unique_ptr<SessionDao> sessionDao;
private: private:
Session retrieveSession(std::string token) const; Session retrieveSession(std::string token) const;
public: public:
RequestWorker(HandlerFactory &handlerFactory, SessionDao &sessionDao, Template &templ) RequestWorker(HandlerFactory &handlerFactory, std::unique_ptr<SessionDao> sessionDao, Template &templ)
{ {
this->handlerFactory = &handlerFactory; this->handlerFactory = &handlerFactory;
this->templ = &templ; this->templ = &templ;
this->sessionDao = &sessionDao; this->sessionDao = std::move(sessionDao);
} }