mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
实现getIdentifier接口
This commit is contained in:
parent
f98546a64c
commit
21acda1e42
@ -1 +1 @@
|
|||||||
Subproject commit bb2ba9005b0191f709897bf51e5bb719eac856bb
|
Subproject commit cff0af9180984312035ab5972a47e6b632e0919f
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user