Loading plugins/media/media.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -554,8 +554,17 @@ namespace blogi { std::vector<char> suuid,data; _getSuuid(ccurl,plen,suuid); if(req->RecvData.pos<_store->getSize(suuid.data())){ _store->load(req,suuid.data(),data,req->RecvData.pos,BLOCKSIZE); size_t msize = _store->getSize(suuid.data()); size_t ssize = msize-req->SendData.pos < BLOCKSIZE ? msize-req->SendData.pos : BLOCKSIZE; if(req->SendData.getlimit() < ssize){ return true; } if(req->RecvData.pos<msize){ _store->load(req,suuid.data(),data,req->RecvData.pos,ssize); req->SendData.append(data.data(),data.size()); req->RecvData.pos+=data.size(); return true; Loading plugins/media/redis.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ blogi::RedisStore::RedisStore(const char *host,int port,const char *password,int millitout){ struct timeval timeout = { 0, millitout }; // 1.5 seconds _RedisCTX=redisConnectWithTimeout(host,port,timeout); REDISCONNECT: _RedisCTX=redisConnectNonBlock(host,port); if (_RedisCTX->err) { libhttppp::HTTPException exp; Loading @@ -57,7 +57,6 @@ blogi::RedisStore::~RedisStore(){ } size_t blogi::RedisStore::getSize(const char* key){ redisReply *rep=(redisReply*)redisCommand(_RedisCTX,"STRLEN %s",key); if(_RedisCTX->err!=REDIS_OK){ libhttppp::HTTPException e; Loading @@ -65,13 +64,19 @@ size_t blogi::RedisStore::getSize(const char* key){ throw e; } if(rep->type == REDIS_REPLY_ERROR){ redisReply *rep=(redisReply*)redisCommand(_RedisCTX,"STRLEN %s",key); if(!rep || rep->type != REDIS_REPLY_INTEGER){ libhttppp::HTTPException e; e[libhttppp::HTTPException::Error] << "media plugin err: " << rep->str; e[libhttppp::HTTPException::Error] << "media plugin err: wrong redis reply in getsize !"; throw e; } return rep->integer; size_t ret = rep->integer; freeReplyObject(rep); return ret; } Loading plugins/nginxfiler/filer.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <iostream> #include <chrono> #include <thread> #include <cstring> #include <cmath> #include <string> Loading Loading @@ -317,8 +316,6 @@ namespace blogi { }; } std::cout << json << std::endl; struct json_object *ndir; ndir = json_tokener_parse(json.c_str()); Loading Loading
plugins/media/media.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -554,8 +554,17 @@ namespace blogi { std::vector<char> suuid,data; _getSuuid(ccurl,plen,suuid); if(req->RecvData.pos<_store->getSize(suuid.data())){ _store->load(req,suuid.data(),data,req->RecvData.pos,BLOCKSIZE); size_t msize = _store->getSize(suuid.data()); size_t ssize = msize-req->SendData.pos < BLOCKSIZE ? msize-req->SendData.pos : BLOCKSIZE; if(req->SendData.getlimit() < ssize){ return true; } if(req->RecvData.pos<msize){ _store->load(req,suuid.data(),data,req->RecvData.pos,ssize); req->SendData.append(data.data(),data.size()); req->RecvData.pos+=data.size(); return true; Loading
plugins/media/redis.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ blogi::RedisStore::RedisStore(const char *host,int port,const char *password,int millitout){ struct timeval timeout = { 0, millitout }; // 1.5 seconds _RedisCTX=redisConnectWithTimeout(host,port,timeout); REDISCONNECT: _RedisCTX=redisConnectNonBlock(host,port); if (_RedisCTX->err) { libhttppp::HTTPException exp; Loading @@ -57,7 +57,6 @@ blogi::RedisStore::~RedisStore(){ } size_t blogi::RedisStore::getSize(const char* key){ redisReply *rep=(redisReply*)redisCommand(_RedisCTX,"STRLEN %s",key); if(_RedisCTX->err!=REDIS_OK){ libhttppp::HTTPException e; Loading @@ -65,13 +64,19 @@ size_t blogi::RedisStore::getSize(const char* key){ throw e; } if(rep->type == REDIS_REPLY_ERROR){ redisReply *rep=(redisReply*)redisCommand(_RedisCTX,"STRLEN %s",key); if(!rep || rep->type != REDIS_REPLY_INTEGER){ libhttppp::HTTPException e; e[libhttppp::HTTPException::Error] << "media plugin err: " << rep->str; e[libhttppp::HTTPException::Error] << "media plugin err: wrong redis reply in getsize !"; throw e; } return rep->integer; size_t ret = rep->integer; freeReplyObject(rep); return ret; } Loading
plugins/nginxfiler/filer.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <iostream> #include <chrono> #include <thread> #include <cstring> #include <cmath> #include <string> Loading Loading @@ -317,8 +316,6 @@ namespace blogi { }; } std::cout << json << std::endl; struct json_object *ndir; ndir = json_tokener_parse(json.c_str()); Loading