适配ZLToolKit

This commit is contained in:
xiongziliang
2020-04-24 12:39:22 +08:00
parent a9fcd9dbc1
commit b4228f91c3
12 changed files with 32 additions and 35 deletions

View File

@@ -28,7 +28,7 @@ void HttpDownloader::startDownload(const string& url, const string& filePath,boo
if(_filePath.empty()){
_filePath = exeDir() + "HttpDownloader/" + MD5(url).hexdigest();
}
_saveFile = File::createfile_file(_filePath.data(),bAppend ? "ab" : "wb");
_saveFile = File::create_file(_filePath.data(), bAppend ? "ab" : "wb");
if(!_saveFile){
auto strErr = StrPrinter << "打开文件失败:" << filePath << endl;
throw std::runtime_error(strErr);

View File

@@ -315,7 +315,7 @@ public:
SockInfoImp() = default;
~SockInfoImp() override = default;
const string &get_local_ip() override{
string get_local_ip() override{
return _local_ip;
}
@@ -323,9 +323,8 @@ public:
return _local_port;
}
const string &get_peer_ip() override{
string get_peer_ip() override{
return _peer_ip;
}
uint16_t get_peer_port() override{

View File

@@ -59,7 +59,7 @@ int64_t HttpSession::onRecvHeader(const char *header,uint64_t len) {
string cmd = _parser.Method();
auto it = s_func_map.find(cmd);
if (it == s_func_map.end()) {
WarnL << "不支持该命令:" << cmd;
WarnP(this) << "不支持该命令:" << cmd;
sendResponse("405 Not Allowed", true);
return 0;
}

View File

@@ -41,11 +41,11 @@ public:
typedef std::function<void(const string &errMsg,const string &accessPath, int cookieLifeSecond)> HttpAccessPathInvoker;
HttpSession(const Socket::Ptr &pSock);
virtual ~HttpSession();
~HttpSession() override;
virtual void onRecv(const Buffer::Ptr &) override;
virtual void onError(const SockException &err) override;
virtual void onManager() override;
void onRecv(const Buffer::Ptr &) override;
void onError(const SockException &err) override;
void onManager() override;
static string urlDecode(const string &str);
protected:
//FlvMuxer override
@@ -80,7 +80,7 @@ protected:
* @return true代表允许websocket连接否则拒绝
*/
virtual bool onWebSocketConnect(const Parser &header){
WarnL << "http server do not support websocket default";
WarnP(this) << "http server do not support websocket default";
return false;
}