fix: WebRtcTransport 切换 poller 线程时,创建 WebRtcSession 不需要加锁

This commit is contained in:
Johnny 2022-11-28 17:52:28 +08:00
parent bc4fa2bc53
commit 59ecdd13e5

View File

@ -68,7 +68,7 @@ void WebRtcSession::onRecv_l(const char *data, size_t len) {
//WebRtcTransport在其他poller线程上需要切换poller线程并重新创建WebRtcSession对象 //WebRtcTransport在其他poller线程上需要切换poller线程并重新创建WebRtcSession对象
if (!transport->getPoller()->isCurrentThread()) { if (!transport->getPoller()->isCurrentThread()) {
auto sock = Socket::createSocket(transport->getPoller()); auto sock = Socket::createSocket(transport->getPoller(), false);
//1、克隆socket(fd不变)切换poller线程到WebRtcTransport所在线程 //1、克隆socket(fd不变)切换poller线程到WebRtcTransport所在线程
sock->cloneFromPeerSocket(*(getSock())); sock->cloneFromPeerSocket(*(getSock()));
auto server = _server; auto server = _server;