QTSS_Error Initialize(QTSS_Initialize_Params* inParams)
{
    // Get global dictionaries
    sServer = inParams->inServer;
    sPrefs = QTSSModuleUtils::GetModulePrefsObject(inParams->inModule);

    // Setup module utils
    QTSSModuleUtils::Initialize(inParams->inMessages, inParams->inServer, inParams->inErrorLogStream);
    
    // Get service IDs
    (void)QTSS_IDForService(QTSS_REREAD_PREFS_SERVICE, &sRereadPreferences);
    (void)QTSS_IDForService("RollAccessLog", &sRollAccessLog);
    (void)QTSS_IDForService("RollErrorLog", &sRollErrorLog);
    
    sHistoryMutex = NEW OSMutex();
    sStartupTime = ::time(NULL);//store time_t value for startup of the server

    //allocate enough space to store the largest attribute possible
    sAttributeBuffer = NEW char[sizeof(QTSServerHistoryRec)];   
    sThread = NEW QTSSvrControlThread();
    if (sThread->HasErrorOccurred())
    {
        delete sThread;
        sThread = NULL;
        return QTSS_RequestFailed;
    }
    return QTSS_NoErr;

}
Esempio n. 2
0
QTSS_Error Initialize(QTSS_Initialize_Params* inParams)
{   
    sAdminMutex = NEW OSMutex();
    ElementNode_InitPtrArray();
    // Setup module utils
    QTSSModuleUtils::Initialize(inParams->inMessages, inParams->inServer, inParams->inErrorLogStream);

    sQTSSparams = *inParams;
    sServer = inParams->inServer;
    sModule = inParams->inModule;
	
	sAccessLogPrefs = QTSSModuleUtils::GetModulePrefsObject(QTSSModuleUtils::GetModuleObjectByName("QTSSAccessLogModule"));
    sReflectorPrefs = QTSSModuleUtils::GetModulePrefsObject(QTSSModuleUtils::GetModuleObjectByName("QTSSReflectorModule"));

    sModulePrefs = QTSSModuleUtils::GetModulePrefsObject(sModule);
    sServerPrefs = inParams->inPrefs;

	RereadPrefs();
    
	//创建Mongoose线程、启动
	sMongooseThread = NEW mongooseThread();
	sMongooseThread->Start();
    
    return QTSS_NoErr;
}
Esempio n. 3
0
QTSS_Error Register(QTSS_Register_Params* inParams)
{
    sLogMutex = NEW OSMutex();
    
    // Do role & service setup
    
    (void)QTSS_AddRole(QTSS_ErrorLog_Role);
    (void)QTSS_AddRole(QTSS_Shutdown_Role);
    (void)QTSS_AddRole(QTSS_StateChange_Role);
    
    (void)QTSS_AddService("RollErrorLog", &RollErrorLog);
    
    // Unlike most modules, all initialization for this module happens in
    // the register role. This is so that this error log can begin logging
    // errors ASAP.
    
    CheckErrorLogState();
    WriteStartupMessage();
    
    // Tell the server our name!
    static char* sModuleName = "QTSSErrorLogModule";
    ::strcpy(inParams->outModuleName, sModuleName);
    
    sErrorLogCheckTask = NEW ErrorLogCheckTask();

    return QTSS_NoErr;
}
QTSS_Error Initialize(QTSS_Initialize_Params* inParams)
{
    // Setup module utils
    QTSSModuleUtils::Initialize(inParams->inMessages, inParams->inServer, inParams->inErrorLogStream);
    sPrefs = QTSSModuleUtils::GetModulePrefsObject(inParams->inModule);
    sMutex = NEW OSMutex();
    sHashTable = NEW IPAddrHashTable(277);//277 is prime, I think...
    RereadPrefs();
    return QTSS_NoErr;
}
Esempio n. 5
0
QTSS_Error Initialize(QTSS_Initialize_Params* inParams)
{
    // Setup module utils
    QTSSModuleUtils::Initialize(inParams->inMessages, inParams->inServer, inParams->inErrorLogStream);
    sUserMutex = NEW OSMutex();

    RereadPrefs();

    return QTSS_NoErr;
}
Esempio n. 6
0
QTSSDictionary::QTSSDictionary(QTSSDictionaryMap* inMap, OSMutex* inMutex) 
:   fAttributes(NULL), fInstanceAttrs(NULL), fInstanceArraySize(0),
    fMap(inMap), fInstanceMap(NULL), fMutexP(inMutex), fMyMutex(false), fLocked(false)
{
    if (fMap != NULL)
        fAttributes = NEW DictValueElement[inMap->GetNumAttrs()];
	if (fMutexP == NULL)
	{
		fMyMutex = true;
		fMutexP = NEW OSMutex();
	}
}
Esempio n. 7
0
void QTAccessFile::Initialize() // called by server at initialize never call again
{
    if (NULL == sAccessFileMutex)
    {   sAccessFileMutex = NEW OSMutex();
    }
}
Esempio n. 8
0
void QTRTPFile::Initialize(void)
{
    QTRTPFile::gFileCacheMutex = NEW OSMutex();
    QTRTPFile::gFileCacheAddMutex = NEW OSMutex();
}
Esempio n. 9
0
void QTRTPFile::AddFileToCache(const char *inFilename, QTRTPFile::RTPFileCacheEntry ** newListEntry)
{
    // General vars
    OSMutexLocker                   fileCacheMutex(QTRTPFile::gFileCacheMutex);
    QTRTPFile::RTPFileCacheEntry*   listEntry;
    QTRTPFile::RTPFileCacheEntry*   lastListEntry;
    
    
    //
    // Add this track object to our track list.
    (*newListEntry) = NEW QTRTPFile::RTPFileCacheEntry();
    if( (*newListEntry) == NULL )
        return;

    (*newListEntry)->InitMutex = NEW OSMutex();
    if( (*newListEntry)->InitMutex == NULL ) {
        delete (*newListEntry);
        *newListEntry = NULL;
        return;
    }
    (*newListEntry)->InitMutex->Lock();
    
    (*newListEntry)->fFilename = NEW char[(::strlen(inFilename) + 2)];
    ::strcpy((*newListEntry)->fFilename, inFilename);
    (*newListEntry)->File = NULL;
    
    (*newListEntry)->ReferenceCount = 1;

    (*newListEntry)->PrevEntry = NULL;
    (*newListEntry)->NextEntry = NULL;

    //
    // Make this the first entry if there are no entries, otherwise we need to
    // find out where this file fits in the list and insert it there.
    if( QTRTPFile::gFirstFileCacheEntry == NULL ) 
    {
        QTRTPFile::gFirstFileCacheEntry = (*newListEntry);
    }
    else
    {
        //
        // Go through the cache list until we find an inode number greater than
        // the one that we have now.  Insert it in the list when we find this.
        for( listEntry = lastListEntry = QTRTPFile::gFirstFileCacheEntry; listEntry != NULL; listEntry = listEntry->NextEntry ) {
            //
            // This is the last list entry that we saw (useful for later).
            lastListEntry = listEntry;
            
            //
            // Skip this entry if this inode number is smaller than the one
            // for our new entry.
            if( strcmp(listEntry->fFilename,inFilename) < 0 )
                continue;
            
            //
            // We've found a larger inode; insert this one in the list.
            if( listEntry->PrevEntry == NULL )
                QTRTPFile::gFirstFileCacheEntry = (*newListEntry);
            else
                listEntry->PrevEntry->NextEntry = (*newListEntry);
                
            (*newListEntry)->PrevEntry = listEntry->PrevEntry;
            
            listEntry->PrevEntry = (*newListEntry);
            
            (*newListEntry)->NextEntry = listEntry;
            
            return;
        }
        
        //
        // We fell out of our loop; this means that we are the largest inode
        // in the list; add ourselves to the end of the list.
        if( lastListEntry == NULL ) { // this can't happen, but..
            QTRTPFile::gFirstFileCacheEntry = (*newListEntry);
        }
        else
        {
            lastListEntry->NextEntry = (*newListEntry);
            (*newListEntry)->PrevEntry = lastListEntry;
        }
    }
}