| | |
| | | using TASK_FUNCTION = std::function<void(std::shared_ptr<finishSdkHdlManage> &, int)>; |
| | | public: |
| | | BaiscSDKAnalysVideo(TASK_FUNCTION task_f = nullptr) : m_task_function(task_f) { |
| | | resetFdfs(); |
| | | { |
| | | std::thread httpServer([&]() { |
| | | HttpSrvRetRecieve httpSrvRetRecieve("0.0.0.0", 9090, 1); |
| | | httpSrvRetRecieve.setInfo("^/resetFdfs$", "POST", std::bind(&BaiscSDKAnalysVideo::resetFdfs, this, |
| | | std::placeholders::_1, |
| | | std::placeholders::_2, |
| | | std::placeholders::_3)); |
| | | httpSrvRetRecieve.start(); |
| | | httpSrvRetRecieve.waitForShutDown(); |
| | | }); |
| | | httpServer.detach(); |
| | | } |
| | | // resetFdfs(); |
| | | // { |
| | | // std::thread httpServer([&]() { |
| | | // HttpSrvRetRecieve httpSrvRetRecieve("0.0.0.0", 9090, 1); |
| | | // httpSrvRetRecieve.setInfo("^/resetFdfs$", "POST", std::bind(&BaiscSDKAnalysVideo::resetFdfs, this, |
| | | // std::placeholders::_1, |
| | | // std::placeholders::_2, |
| | | // std::placeholders::_3)); |
| | | // httpSrvRetRecieve.start(); |
| | | // httpSrvRetRecieve.waitForShutDown(); |
| | | // }); |
| | | // httpServer.detach(); |
| | | // } |
| | | } |
| | | |
| | | ~BaiscSDKAnalysVideo() { |
| | | } |
| | | |
| | | std::string resetFdfs(std::string ip = "", unsigned int port = 0, std::string content = "") { |
| | | |
| | | std::thread reset([&]() { |
| | | fdfsClient.rwLock.rdlock(); |
| | | if (fdfsClient.fastFds != nullptr) { |
| | | delete fdfsClient.fastFds; |
| | | } |
| | | fdfsClient.fastFds = new FastFds("fastDfsClient.conf"); |
| | | fdfsClient.rwLock.unlock(); |
| | | }); |
| | | reset.detach(); |
| | | |
| | | return ""; |
| | | } |
| | | // std::string resetFdfs(std::string ip = "", unsigned int port = 0, std::string content = "") { |
| | | // |
| | | // std::thread reset([&]() { |
| | | // fdfsClient.rwLock.rdlock(); |
| | | // if (fdfsClient.fastFds != nullptr) { |
| | | // delete fdfsClient.fastFds; |
| | | // } |
| | | // fdfsClient.fastFds = new FastFds("fastDfsClient.conf"); |
| | | // fdfsClient.rwLock.unlock(); |
| | | // }); |
| | | // reset.detach(); |
| | | // |
| | | // return ""; |
| | | // } |
| | | |
| | | private: |
| | | virtual void doFunc(std::shared_ptr<getsdkHdlManage> spPacket) { |