diff --git a/ZLToolKit b/ZLToolKit index bb2ba900..cff0af91 160000 --- a/ZLToolKit +++ b/ZLToolKit @@ -1 +1 @@ -Subproject commit bb2ba9005b0191f709897bf51e5bb719eac856bb +Subproject commit cff0af9180984312035ab5972a47e6b632e0919f diff --git a/src/Http/HttpSession.h b/src/Http/HttpSession.h index aeeabaaa..1fdd68a5 100644 --- a/src/Http/HttpSession.h +++ b/src/Http/HttpSession.h @@ -172,7 +172,7 @@ protected: } //这是个WebSocket会话而不是普通的Http会话 _firstPacket = false; - _session = std::make_shared(nullptr,_sock); + _session = std::make_shared(getIdentifier(),nullptr,_sock); auto strongServer = _weakServer.lock(); if(strongServer){ @@ -253,7 +253,11 @@ private: */ class SessionImp : public SessionType{ public: - SessionImp(const std::shared_ptr &pTh, const Socket::Ptr &pSock) : SessionType(pTh,pSock){}; + SessionImp(const string &identifier, + const std::shared_ptr &pTh, + const Socket::Ptr &pSock) : + _identifier(identifier),SessionType(pTh,pSock){} + ~SessionImp(){} /** @@ -285,14 +289,18 @@ private: } return SessionType::send(buf); } + string getIdentifier() const override{ + return _identifier; + } private: onBeforeSendCB _beforeSendCB; + string _identifier; }; private: - std::shared_ptr _session; - string _remian_data; bool _firstPacket = true; + string _remian_data; weak_ptr _weakServer; + std::shared_ptr _session; }; /**