Refine: 调整 WebRtcSession::getPoller 静态函数为 QueryPollerByBuffer 全局函数,以改善其他 getPoller 同名函数可读性。

This commit is contained in:
Johnny 2021-10-13 18:41:17 +08:00
parent 22c68a297e
commit 638ef8c731
3 changed files with 5 additions and 5 deletions

View File

@ -274,7 +274,7 @@ int start_main(int argc,char *argv[]) {
if (!buf) {
return Socket::createSocket(poller, false);
}
auto new_poller = WebRtcSession::getPoller(buf);
auto new_poller = QueryPollerByBuffer(buf);
if (!new_poller) {
//该数据对应的webrtc对象未找到丢弃之
return Socket::Ptr();

View File

@ -40,7 +40,7 @@ static string getUserName(const Buffer::Ptr &buffer) {
return vec[0];
}
EventPoller::Ptr WebRtcSession::getPoller(const Buffer::Ptr &buffer) {
EventPoller::Ptr QueryPollerByBuffer(const Buffer::Ptr &buffer) {
auto user_name = getUserName(buffer);
if (user_name.empty()) {
return nullptr;
@ -80,7 +80,7 @@ void WebRtcSession::onError(const SockException &err) {
return;
}
auto transport = std::move(_transport);
this->Session::getPoller()->async([transport] {
getPoller()->async([transport] {
//延时减引用防止使用transport对象时销毁对象
}, false);
}

View File

@ -18,10 +18,10 @@
using namespace toolkit;
EventPoller::Ptr QueryPollerByBuffer(const Buffer::Ptr &buffer);
class WebRtcSession : public UdpSession {
public:
static EventPoller::Ptr getPoller(const Buffer::Ptr &);
WebRtcSession(const Socket::Ptr &sock);
~WebRtcSession() override;