本文整理汇总了C++中HttpConnection::setLogger方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpConnection::setLogger方法的具体用法?C++ HttpConnection::setLogger怎么用?C++ HttpConnection::setLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpConnection
的用法示例。
在下文中一共展示了HttpConnection::setLogger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addConnection
int HttpListener::addConnection( struct conn_data * pCur, int *iCount )
{
int fd = pCur->fd;
if ( checkAccess( pCur ))
{
no_timewait( fd );
close( fd );
--(*iCount);
return 0;
}
HttpConnection* pConn = HttpConnPool::getConnection();
if ( !pConn )
{
ERR_NO_MEM( "HttpConnPool::getConnection()" );
close( fd );
--(*iCount);
return -1;
}
VHostMap * pMap;
if ( m_pSubIpMap )
{
pMap = getSubMap( fd );
}
else
pMap = getVHostMap();
pConn->setVHostMap( pMap );
pConn->setLogger( getLogger());
pConn->setRemotePort( ntohs( ((sockaddr_in *)(pCur->achPeerAddr))->sin_port) );
if ( pConn->setLink( pCur->fd, pCur->pInfo, pMap->getSSLContext() ) )
{
HttpConnPool::recycle( pConn );
close( fd );
--(*iCount);
return -1;
}
fcntl( fd, F_SETFD, FD_CLOEXEC );
fcntl( fd, F_SETFL, HttpGlobals::getMultiplexer()->getFLTag() );
//pConn->tryRead();
return 0;
}
示例2: batchAddConn
int HttpListener::batchAddConn( struct conn_data * pBegin,
struct conn_data *pEnd, int *iCount )
{
struct conn_data * pCur = pBegin;
int n = pEnd - pBegin;
while( pCur < pEnd )
{
if ( checkAccess( pCur))
{
no_timewait( pCur->fd );
close( pCur->fd );
pCur->fd = -1;
--(*iCount);
--n;
}
++pCur;
}
if ( n <= 0 )
return 0;
HttpConnection* pConns[CONN_BATCH_SIZE];
int ret = HttpConnPool::getConnections( pConns, n);
pCur = pBegin;
if ( ret <= 0 )
{
ERR_NO_MEM( "HttpConnPool::getConnections()" );
LOG_ERR(( "need %d connections, allocated %d connections!", n, ret ));
while( pCur < pEnd )
{
if ( pCur->fd != -1 )
{
close( pCur->fd );
--(*iCount);
}
++pCur;
}
return -1;
}
HttpConnection** pConnEnd = &pConns[ret];
HttpConnection** pConnCur = pConns;
VHostMap * pMap;
int flag = HttpGlobals::getMultiplexer()->getFLTag();
while( pCur < pEnd )
{
register int fd = pCur->fd;
if ( fd != -1 )
{
assert( pConnCur < pConnEnd );
HttpConnection * pConn = *pConnCur;
if ( m_pSubIpMap )
{
pMap = getSubMap( fd );
}
else
pMap = getVHostMap();
pConn->setVHostMap( pMap );
pConn->setLogger( getLogger());
pConn->setRemotePort( ntohs( ((sockaddr_in *)(pCur->achPeerAddr))->sin_port) );
// if ( getDedicated() )
// {
// //pConn->accessGranted();
// }
if ( !pConn->setLink( fd, pCur->pInfo, pMap->getSSLContext() ) )
{
fcntl( fd, F_SETFD, FD_CLOEXEC );
fcntl( fd, F_SETFL, flag );
++pConnCur;
//pConn->tryRead();
}
else
{
close( fd );
--(*iCount);
}
}
++pCur;
}
if ( pConnCur < pConnEnd )
{
HttpConnPool::recycle( pConnCur, pConnEnd - pConnCur);
}
return 0;
}