model_server/gala_communications/src/Application.cxx
/* -----------getAllClients  added 1/27/98 by gbronner-------------------------
Counts clients attached to "cli" and "pmod" services.
we don't count the clients on the inform service because
a) it is just used for querying
b) there is some bug which keeps on adding sessions without deleting them.  I couldn't
figure it out-- any significant rewrite of the Application class should deal with this.
----------------------------------------------------------------------------------*/
getAllClients  added 1/27/98 by gbronner
Counts clients attached to "cli" and "pmod" services.
we don't count the clients on the inform service because
a) it is just used for querying
b) there is some bug which keeps on adding sessions without deleting them.  I couldn't
figure it out-- any significant rewrite of the Application class should deal with this.
getAllClients added 1 / 27 / 98 by gbronner Counts clients attached to " cli " and " pmod " services . we don ' t count the clients on the inform service because a ) it is just used for querying b ) there is some bug which keeps on adding sessions without deleting them . I couldn ' t figure it out -- any significant rewrite of the Application class should deal with this .
int Application::getAllClients()
{
	Application* pCurrentApp=Application::list_;
	int nRet =-1;
	int nTotal=0;
	int nServiceNotFound =0;
	while (pCurrentApp)
	{	
		if (!strstr(((const char *)pCurrentApp->name_), "inform:"))
		{
			if(pCurrentApp->service_ )
			{
				vserviceSessionIterator iter;
				iter.Start( pCurrentApp->service_ );
				while( iter.Next() )
				{
					vsession *ssn = iter.GetValue();
					if( ssn && ssn->IsActive() )
						nTotal++;
				}
				iter.Finish();
			} 
			else 
			{ 
				nServiceNotFound=-1;
			}	
		}
		pCurrentApp=pCurrentApp->next_;	
	}
	if (!nServiceNotFound)
		nRet = nTotal;
	return nRet;	
}
int Application :: getAllClients ( ) { Application * pCurrentApp = Application :: list_ ; int nRet = -1 ; int nTotal = 0 ; int nServiceNotFound = 0 ; while ( pCurrentApp ) { if ( ! strstr ( ( ( const char * ) pCurrentApp -> name_ ) , " " ) ) { if ( pCurrentApp -> service_ ) { vserviceSessionIterator iter ; iter . Start ( pCurrentApp -> service_ ) ; while ( iter . Next ( ) ) { vsession * ssn = iter . GetValue ( ) ; if ( ssn && ssn -> IsActive ( ) ) nTotal ++ ; } iter . Finish ( ) ; } else { nServiceNotFound = -1 ; } } pCurrentApp = pCurrentApp -> next_ ; } if ( ! nServiceNotFound ) nRet = nTotal ; return nRet ; }
getAllClients  added 1/27/98 by gbronner
Counts clients attached to "cli" and "pmod" services.
getAllClients added 1 / 27 / 98 by gbronner Counts clients attached to " cli " and " pmod " services .