mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-30 23:02:24 +08:00
实现getIdentifier接口
This commit is contained in:
Submodule ZLToolKit updated: bb2ba9005b...cff0af9180
@@ -172,7 +172,7 @@ protected:
|
|||||||
}
|
}
|
||||||
//这是个WebSocket会话而不是普通的Http会话
|
//这是个WebSocket会话而不是普通的Http会话
|
||||||
_firstPacket = false;
|
_firstPacket = false;
|
||||||
_session = std::make_shared<SessionImp>(nullptr,_sock);
|
_session = std::make_shared<SessionImp>(getIdentifier(),nullptr,_sock);
|
||||||
|
|
||||||
auto strongServer = _weakServer.lock();
|
auto strongServer = _weakServer.lock();
|
||||||
if(strongServer){
|
if(strongServer){
|
||||||
@@ -253,7 +253,11 @@ private:
|
|||||||
*/
|
*/
|
||||||
class SessionImp : public SessionType{
|
class SessionImp : public SessionType{
|
||||||
public:
|
public:
|
||||||
SessionImp(const std::shared_ptr<ThreadPool> &pTh, const Socket::Ptr &pSock) : SessionType(pTh,pSock){};
|
SessionImp(const string &identifier,
|
||||||
|
const std::shared_ptr<ThreadPool> &pTh,
|
||||||
|
const Socket::Ptr &pSock) :
|
||||||
|
_identifier(identifier),SessionType(pTh,pSock){}
|
||||||
|
|
||||||
~SessionImp(){}
|
~SessionImp(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,14 +289,18 @@ private:
|
|||||||
}
|
}
|
||||||
return SessionType::send(buf);
|
return SessionType::send(buf);
|
||||||
}
|
}
|
||||||
|
string getIdentifier() const override{
|
||||||
|
return _identifier;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
onBeforeSendCB _beforeSendCB;
|
onBeforeSendCB _beforeSendCB;
|
||||||
|
string _identifier;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<SessionImp> _session;
|
|
||||||
string _remian_data;
|
|
||||||
bool _firstPacket = true;
|
bool _firstPacket = true;
|
||||||
|
string _remian_data;
|
||||||
weak_ptr<TcpServer> _weakServer;
|
weak_ptr<TcpServer> _weakServer;
|
||||||
|
std::shared_ptr<SessionImp> _session;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user