修复webrtcsession getIdentifier 为空的bug,导致GetAllSession webrtcsession的id 为空

This commit is contained in:
xiongguangjie 2022-09-07 13:58:26 +08:00
parent 4f47b7a5fe
commit 96c19ac85f
2 changed files with 2 additions and 6 deletions

View File

@ -58,7 +58,6 @@ void WebRtcSession::onRecv(const Buffer::Ptr &buffer) {
//只允许寻找一次transport //只允许寻找一次transport
_find_transport = false; _find_transport = false;
auto user_name = getUserName(buffer); auto user_name = getUserName(buffer);
_identifier = to_string(getSock()->rawFD()) + '-' + user_name;
auto transport = WebRtcTransportManager::Instance().getItem(user_name); auto transport = WebRtcTransportManager::Instance().getItem(user_name);
CHECK(transport && transport->getPoller()->isCurrentThread()); CHECK(transport && transport->getPoller()->isCurrentThread());
transport->setSession(shared_from_this()); transport->setSession(shared_from_this());
@ -97,7 +96,5 @@ void WebRtcSession::onManager() {
} }
} }
std::string WebRtcSession::getIdentifier() const {
return _identifier;
}

View File

@ -24,12 +24,11 @@ public:
void onRecv(const Buffer::Ptr &) override; void onRecv(const Buffer::Ptr &) override;
void onError(const SockException &err) override; void onError(const SockException &err) override;
void onManager() override; void onManager() override;
std::string getIdentifier() const override; //std::string getIdentifier() const override;
static EventPoller::Ptr queryPoller(const Buffer::Ptr &buffer); static EventPoller::Ptr queryPoller(const Buffer::Ptr &buffer);
private: private:
std::string _identifier;
bool _find_transport = true; bool _find_transport = true;
Ticker _ticker; Ticker _ticker;
struct sockaddr_storage _peer_addr; struct sockaddr_storage _peer_addr;