恢复原来代码

This commit is contained in:
xiongziliang
2019-01-30 17:26:02 +08:00
parent c0d3c0f032
commit 6ecd21cd6c
3 changed files with 3 additions and 28 deletions

View File

@@ -70,42 +70,19 @@ static unordered_map<string, weak_ptr<RtspSession> > g_mapGetter;
//对g_mapGetter上锁保护
static recursive_mutex g_mtxGetter;
//rtsp会话个数统计
static recursive_mutex g_mtxSessionCounter;
static unordered_map<string,atomic<uint32_t > > g_mapSessionCounter;
static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE;
uint32_t RtspSession::getSessionCountOnInterface(const string &ifr){
lock_guard<recursive_mutex> lck(g_mtxSessionCounter);
if(ifr.empty()){
int i = 0;
for(auto &pr : g_mapSessionCounter){
i += pr.second;
}
return i;
}
return g_mapSessionCounter[ifr];
}
RtspSession::RtspSession(const Socket::Ptr &pSock) : TcpSession(pSock) {
//设置10秒发送缓存
pSock->setSendBufSecond(30);
pSock->setSendBufSecond(10);
//设置15秒发送超时时间
pSock->setSendTimeOutSecond(45);
pSock->setSendTimeOutSecond(15);
DebugL << get_peer_ip();
lock_guard<recursive_mutex> lck(g_mtxSessionCounter);
++(g_mapSessionCounter[get_local_ip()]);
}
RtspSession::~RtspSession() {
DebugL << get_peer_ip();
lock_guard<recursive_mutex> lck(g_mtxSessionCounter);
--(g_mapSessionCounter[get_local_ip()]);
}
void RtspSession::onError(const SockException& err) {