mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
Refine: 调整 WebRtcSession::getPoller 静态函数为 QueryPollerByBuffer 全局函数,以改善其他 getPoller 同名函数可读性。
This commit is contained in:
parent
22c68a297e
commit
638ef8c731
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user