cleaned up some minor bugs.

This commit is contained in:
crs
2002-06-21 17:55:47 +00:00
parent e0f66d162f
commit ede18cb7f3
7 changed files with 86 additions and 44 deletions

View File

@@ -52,25 +52,36 @@ CClient::camp(bool on)
m_camp = on;
}
bool
CClient::open()
{
// open the screen
try {
log((CLOG_INFO "opening screen"));
openSecondaryScreen();
return true;
}
catch (XScreenOpenFailure&) {
// can't open screen yet. wait a few seconds to retry.
CThread::sleep(3.0);
log((CLOG_INFO "failed to open screen"));
return false;
}
}
bool
CClient::run(const CNetworkAddress& serverAddress)
{
// check preconditions
{
CLock lock(&m_mutex);
assert(m_screen != NULL);
}
CThread* thread = NULL;
try {
log((CLOG_NOTE "starting client"));
// connect to secondary screen
while (m_screen == NULL) {
try {
openSecondaryScreen();
}
catch (XScreenOpenFailure&) {
// can't open screen yet. wait a few seconds to retry.
log((CLOG_INFO "failed to open screen. waiting to retry."));
CThread::sleep(3.0);
}
}
// start server interactions
m_serverAddress = &serverAddress;
thread = new CThread(new TMethodJob<CClient>(this, &CClient::runSession));
@@ -108,9 +119,7 @@ CClient::run(const CNetworkAddress& serverAddress)
thread->wait();
delete thread;
}
if (m_screen != NULL) {
closeSecondaryScreen();
}
closeSecondaryScreen();
throw;
}
catch (...) {
@@ -123,9 +132,7 @@ CClient::run(const CNetworkAddress& serverAddress)
thread->wait();
delete thread;
}
if (m_screen != NULL) {
closeSecondaryScreen();
}
closeSecondaryScreen();
throw;
}
}