linux udt 源码,UDT linux下关闭链接耗时过长
不知道使用UDT的人多不多,很大可能會(huì)石沉大海啊
=========================================================
我在使用UDT庫的時(shí)候,linux下正常關(guān)閉一個(gè)連接耗時(shí)要300ms,Windows下耗時(shí)只要十幾毫秒,跟蹤到代碼是在core.cpp中的
“
void CUDT::close()
{
if (!m_bOpened)
return;
if (0 != m_Linger.l_onoff)
{
uint64_t entertime = CTimer::getTime();
// 就是這個(gè)while循環(huán)耗時(shí)很長
while (!m_bBroken && m_bConnected && (m_pSndBuffer->getCurrBufSize() > 0) && (CTimer::getTime() - entertime < m_Linger.l_linger * 1000000ULL))
{
// linger has been checked by previous close() call and has expired
if (m_ullLingerExpiration >= entertime)
break;
if (!m_bSynSending)
{
// if this socket enables asynchronous sending, return immediately and let GC to close it later
if (0 == m_ullLingerExpiration)
m_ullLingerExpiration = entertime + m_Linger.l_linger * 1000000ULL;
return;
}
#ifndef WIN32
timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 1000000;
nanosleep(&ts, NULL);
#else
Sleep(1);
#endif
}
}
.................................
}
”
===================================================================
有沒有對(duì)UDT協(xié)議熟悉的好友幫忙看看
總結(jié)
以上是生活随笔為你收集整理的linux udt 源码,UDT linux下关闭链接耗时过长的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 页面URL传递中文乱码
- 下一篇: SocksCap代理