mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-04-01 19:20:53 +08:00
统一成员变量命名风格
This commit is contained in:
@@ -48,10 +48,10 @@ UDPServer::~UDPServer() {
|
||||
}
|
||||
|
||||
Socket::Ptr UDPServer::getSock(const char* strLocalIp, int iTrackIndex,uint16_t iLocalPort) {
|
||||
lock_guard<mutex> lck(m_mtxUpdSock);
|
||||
lock_guard<mutex> lck(_mtxUpdSock);
|
||||
string strKey = StrPrinter << strLocalIp << ":" << iTrackIndex << endl;
|
||||
auto it = m_mapUpdSock.find(strKey);
|
||||
if (it == m_mapUpdSock.end()) {
|
||||
auto it = _mapUpdSock.find(strKey);
|
||||
if (it == _mapUpdSock.end()) {
|
||||
Socket::Ptr pSock(new Socket());
|
||||
//InfoL<<localIp;
|
||||
if (!pSock->bindUdpSock(iLocalPort, strLocalIp)) {
|
||||
@@ -61,7 +61,7 @@ Socket::Ptr UDPServer::getSock(const char* strLocalIp, int iTrackIndex,uint16_t
|
||||
|
||||
pSock->setOnRead(bind(&UDPServer::onRcvData, this, iTrackIndex, placeholders::_1,placeholders::_2));
|
||||
pSock->setOnErr(bind(&UDPServer::onErr, this, strKey, placeholders::_1));
|
||||
m_mapUpdSock[strKey] = pSock;
|
||||
_mapUpdSock[strKey] = pSock;
|
||||
DebugL << strLocalIp << " " << pSock->get_local_port() << " " << iTrackIndex;
|
||||
return pSock;
|
||||
}
|
||||
@@ -69,15 +69,15 @@ Socket::Ptr UDPServer::getSock(const char* strLocalIp, int iTrackIndex,uint16_t
|
||||
}
|
||||
|
||||
void UDPServer::listenPeer(const char* strPeerIp, void* pSelf, const onRecvData& cb) {
|
||||
lock_guard<mutex> lck(m_mtxDataHandler);
|
||||
auto &mapRef = m_mapDataHandler[strPeerIp];
|
||||
lock_guard<mutex> lck(_mtxDataHandler);
|
||||
auto &mapRef = _mapDataHandler[strPeerIp];
|
||||
mapRef.emplace(pSelf, cb);
|
||||
}
|
||||
|
||||
void UDPServer::stopListenPeer(const char* strPeerIp, void* pSelf) {
|
||||
lock_guard<mutex> lck(m_mtxDataHandler);
|
||||
auto it0 = m_mapDataHandler.find(strPeerIp);
|
||||
if (it0 == m_mapDataHandler.end()) {
|
||||
lock_guard<mutex> lck(_mtxDataHandler);
|
||||
auto it0 = _mapDataHandler.find(strPeerIp);
|
||||
if (it0 == _mapDataHandler.end()) {
|
||||
return;
|
||||
}
|
||||
auto &mapRef = it0->second;
|
||||
@@ -86,22 +86,22 @@ void UDPServer::stopListenPeer(const char* strPeerIp, void* pSelf) {
|
||||
mapRef.erase(it1);
|
||||
}
|
||||
if (mapRef.size() == 0) {
|
||||
m_mapDataHandler.erase(it0);
|
||||
_mapDataHandler.erase(it0);
|
||||
}
|
||||
|
||||
}
|
||||
void UDPServer::onErr(const string& strKey, const SockException& err) {
|
||||
WarnL << err.what();
|
||||
lock_guard<mutex> lck(m_mtxUpdSock);
|
||||
m_mapUpdSock.erase(strKey);
|
||||
lock_guard<mutex> lck(_mtxUpdSock);
|
||||
_mapUpdSock.erase(strKey);
|
||||
}
|
||||
void UDPServer::onRcvData(int iTrackIndex, const Buffer::Ptr &pBuf, struct sockaddr* pPeerAddr) {
|
||||
//TraceL << trackIndex;
|
||||
struct sockaddr_in *in = (struct sockaddr_in *) pPeerAddr;
|
||||
string peerIp = inet_ntoa(in->sin_addr);
|
||||
lock_guard<mutex> lck(m_mtxDataHandler);
|
||||
auto it0 = m_mapDataHandler.find(peerIp);
|
||||
if (it0 == m_mapDataHandler.end()) {
|
||||
lock_guard<mutex> lck(_mtxDataHandler);
|
||||
auto it0 = _mapDataHandler.find(peerIp);
|
||||
if (it0 == _mapDataHandler.end()) {
|
||||
return;
|
||||
}
|
||||
auto &mapRef = it0->second;
|
||||
@@ -112,7 +112,7 @@ void UDPServer::onRcvData(int iTrackIndex, const Buffer::Ptr &pBuf, struct socka
|
||||
}
|
||||
}
|
||||
if (mapRef.size() == 0) {
|
||||
m_mapDataHandler.erase(it0);
|
||||
_mapDataHandler.erase(it0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user