Commit 5beaa736 authored by jan.koester's avatar jan.koester
Browse files

fixed redis mem leak

parent 4a40c66f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ namespace blogi {
        void save(int tid,const char *key,const char *data,size_t datalen) override;
        void load(int tid,libhttppp::HttpRequest *req,const char *key,std::vector<char> &data,size_t pos,size_t blocksize) override;
    private:
        redisContext     **_RedisCTX;
        std::vector<redisContext*> _RedisCTX;
        std::string                _RedisPassword;
        int                        _Threads;
    };
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@

blogi::RedisStore::RedisStore(const char *host,int port,const char *password,int timeout,int threads){
    _Threads=threads;
    _RedisCTX=new struct redisContext*[_Threads];
    _RedisCTX.resize(_Threads);
    for(int i = 0; i<_Threads; ++i){

        struct timeval tv={0,timeout};
+9 −8
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ blogi::Blogi::~Blogi(){
    delete Page;
    delete MPage;
}
#include <iostream>

void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid){
    char url[512];
    libhttppp::HTTPException excep;
@@ -143,11 +143,12 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid){

    libhtmlpp::HtmlString out;

    libhtmlpp::HtmlElement index;
    std::shared_ptr<libhtmlpp::HtmlElement> index;

    if(curreq->isMobile())
        index=MIndex;
        *index=MIndex;
    else
        index=Index;
        *index=Index;

    if (username.empty() || password.empty()) {
        libhtmlpp::HtmlString condat;
@@ -160,14 +161,14 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid){
               << "</form>"
               << "</div>";

        if(index.getElementbyID("main"))
            index.getElementbyID("main")->insertChild(condat.parse());
        if(index->getElementbyID("main"))
            index->getElementbyID("main")->insertChild(condat.parse());

        for(blogi::Plugin::PluginData *curplg=BlogiPlg->getFirstPlugin(); curplg; curplg=curplg->getNextPlg()){
            curplg->getInstace()->Rendering(tid,curreq,&index);
            curplg->getInstace()->Rendering(tid,curreq,&*index);
        }

        PlgArgs->theme->printSite(tid,out,&index,curreq->getRequestURL(),false);
        PlgArgs->theme->printSite(tid,out,&*index,curreq->getRequestURL(),false);
        libhttppp::HttpResponse curres;
        curres.setState(HTTP200);
        curres.setVersion(HTTPVERSION(1.1));