예제 #1
0
파일: reader.c 프로젝트: jpmens/diablo
Connection *
InitConnection(ForkDesc *desc, DnsRes *dres)
{
    MemPool    *pool = NULL;
    Connection *conn = zalloc(&pool, sizeof(Connection));

    desc->d_Data = conn;

    if (dres)
	conn->co_Auth = *dres;

    conn->co_Desc = desc;
    conn->co_MemPool = pool;
    gettimeofday(&conn->co_RateTv, NULL);
    conn->co_LastActiveTime = conn->co_SessionStartTime = conn->co_RateTv.tv_sec;
    MBInit(&conn->co_TMBuf, desc->d_Fd, &conn->co_MemPool, &conn->co_BufPool);
    MBInit(&conn->co_RMBuf, desc->d_Fd, &conn->co_MemPool, &conn->co_BufPool);
    MBInit(&conn->co_ArtBuf, -1, &conn->co_MemPool, &conn->co_BufPool);

    if (conn->co_Desc->d_Type == THREAD_NNTP) {
	conn->co_ClientTotalByteCount = 0.0;
	conn->co_ClientTotalArticleCount = 0;
	conn->co_ClientGroupByteCount = 0.0;
	conn->co_ClientGroupArticleCount = 0;
	conn->co_ClientGroupCount = conn->co_ClientPostCount = 0;
    }

    return(conn);
}
예제 #2
0
bool GUIIsDBCS( void )
{
    if( !Init ) {
        MBInit();
        Init = TRUE;
    }
    return( IsDBCS );
}
예제 #3
0
int GUICharLen( int ch )
{
    if( !Init ) {
        MBInit();
        Init = TRUE;
    }
    return( __CharLenTable[ch] );
}