//--------------------------------------------------------------------------------
void CSystemMonitorHandlerThread::DoListAll()
	{
	CString sTemp;

	CReadLock lock(GetSystem()->GetDBSubSystem()->GetCertMasters(), false);
	if(! lock.Lock(10000))
		{
		sTemp = "Can't lock the certificate database right now )\r\n";
		m_socket.Send(sTemp, CSmallSocket::WAITFORWOULDBLOCK);
		return;
		}

	POSITION pos = GetSystem()->GetDBSubSystem()->GetCertMasters()->GetHeadPosition();
	if(pos == NULL)
		{
		sTemp = "there are currently 0 connections\r\n";
		m_socket.Send(sTemp, CSmallSocket::WAITFORWOULDBLOCK);
		return;
		}

	CReadLock lock2(GetSystem()->GetDBSubSystem()->GetTokenInfoMap(), false);
	if(! lock2.Lock(1000))
		{
		sTemp = "Can't lock the token database right now\r\n";
		m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
		return;
		}

	sTemp = "IP              Last Refresh          Cert ID User Class Token Name\r\n";
	m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);

	while(pos != NULL)
		{
		CCertificateMaster* pCert = (CCertificateMaster*) GetSystem()->GetDBSubSystem()->GetCertMasters()->GetNext(pos);
		if(! pCert)
			break;

		CReadLock lock(pCert, false);
		if(! lock.Lock(1000))
			{
			sTemp = "Can't lock one of the certificates right now\r\n";
			m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
			continue;
			}

		POSITION pos = pCert->GetTokenMap()->GetStartPosition();
		LPCTSTR pFormat = "%-15s %-20s %8ld %10ld  %-16s\r\n";
		if(pos == NULL)
			{
			sTemp.Format(pFormat,
				pCert->GetIP(), 
				(LPCTSTR) pCert->GetLastRefresh().Format("%c"),
				pCert->GetId(),
				pCert->GetUserClass(),
				"");
			m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
			}
		else
			{
			while(pos != NULL)
				{
				CAccessToken* pTok;
				ULONG nId;
				pCert->GetTokenMap()->GetNextAssoc(pos, nId, pTok);
				if(pTok == NULL)
					break;
				sTemp.Format(pFormat,
					pCert->GetIP(), 
					(LPCTSTR) pCert->GetLastRefresh().Format("%c"),
					pCert->GetId(),
					pCert->GetUserClass(),
					pTok->GetName());
				m_socket.Send(sTemp, sTemp.GetLength(), CSmallSocket::WAITFORWOULDBLOCK);
				}
			}
		}
	}