Thread: [wpdev-commits] wolfpack ChangeLog,1.23,1.24 server.cpp,1.18,1.19
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-09-03 17:30:54
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28435 Modified Files: ChangeLog server.cpp Log Message: Made startup more fault tolerant. Index: server.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/server.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** server.cpp 31 Aug 2004 17:44:37 -0000 1.18 --- server.cpp 3 Sep 2004 17:30:42 -0000 1.19 *************** *** 255,258 **** --- 255,259 ---- { bool error = false; + setState( STARTUP ); *************** *** 284,360 **** } ! // Open the Worldsave and Account Database drivers. ! if ( Config::instance()->databaseDriver() != "binary" && !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); ! return 1; ! } ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->accountsDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->accountsDriver() ) ); ! return 1; ! } ! setState( RUNNING ); ! ScriptManager::instance()->onServerStart(); // Notify all scripts about server startup ! Console::instance()->start(); // Notify the console about the server startup ! PyThreadState* _save; ! QWaitCondition niceLevel; ! unsigned char cycles = 0; ! while ( isRunning() ) ! { ! // Every 10th cycle we sleep for a while and give other threads processing time. ! if ( ++cycles == 10 ) { ! cycles = 0; ! _save = PyEval_SaveThread(); // Python threading - start ! switch ( Config::instance()->niceLevel() ) { ! case 0: ! break; // very unnice - hog all cpu time ! case 1: ! if ( Network::instance()->count() != 0 ) ! niceLevel.wait( 10 ); ! else ! niceLevel.wait( 100 ); break; ! case 2: ! niceLevel.wait( 10 ); break; ! case 3: ! niceLevel.wait( 40 ); break;// very nice ! case 4: ! if ( Network::instance()->count() != 0 ) ! niceLevel.wait( 10 ); ! else ! niceLevel.wait( 4000 ); break; // anti busy waiting ! case 5: ! if ( Network::instance()->count() != 0 ) ! niceLevel.wait( 40 ); ! else ! niceLevel.wait( 5000 ); break; ! default: ! niceLevel.wait( 10 ); break; } - qApp->processEvents( 40 ); - PyEval_RestoreThread( _save ); // Python threading - end - } ! pollQueuedActions(); ! d->time = getNormalizedTime(); // Update our currenttime ! try ! { ! Network::instance()->poll(); ! Timing::instance()->poll(); ! Console::instance()->poll(); ! } ! catch ( wpException e ) ! { ! Console::instance()->log( LOG_PYTHON, e.error() + "\n" ); } } --- 285,369 ---- } ! try { ! // Open the Worldsave and Account Database drivers. ! if ( Config::instance()->databaseDriver() != "binary" && !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); ! return 1; ! } ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->accountsDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->accountsDriver() ) ); ! return 1; ! } ! setState( RUNNING ); ! ScriptManager::instance()->onServerStart(); // Notify all scripts about server startup ! Console::instance()->start(); // Notify the console about the server startup ! PyThreadState* _save; ! QWaitCondition niceLevel; ! unsigned char cycles = 0; ! while ( isRunning() ) { ! // Every 10th cycle we sleep for a while and give other threads processing time. ! if ( ++cycles == 10 ) { ! cycles = 0; ! _save = PyEval_SaveThread(); // Python threading - start ! switch ( Config::instance()->niceLevel() ) ! { ! case 0: ! break; // very unnice - hog all cpu time ! case 1: ! if ( Network::instance()->count() != 0 ) ! niceLevel.wait( 10 ); ! else ! niceLevel.wait( 100 ); break; ! case 2: ! niceLevel.wait( 10 ); break; ! case 3: ! niceLevel.wait( 40 ); break;// very nice ! case 4: ! if ( Network::instance()->count() != 0 ) ! niceLevel.wait( 10 ); ! else ! niceLevel.wait( 4000 ); break; // anti busy waiting ! case 5: ! if ( Network::instance()->count() != 0 ) ! niceLevel.wait( 40 ); ! else ! niceLevel.wait( 5000 ); break; ! default: ! niceLevel.wait( 10 ); break; ! } ! qApp->processEvents( 40 ); ! PyEval_RestoreThread( _save ); // Python threading - end } ! pollQueuedActions(); ! d->time = getNormalizedTime(); // Update our currenttime ! try ! { ! Network::instance()->poll(); ! Timing::instance()->poll(); ! Console::instance()->poll(); ! } ! catch ( wpException e ) ! { ! Console::instance()->log( LOG_PYTHON, e.error() + "\n" ); ! } } + + } catch (wpException &exception) { + Console::instance()->log(LOG_ERROR, exception.error() + "\n" ); + error = true; + } catch (...) { + error = true; } Index: ChangeLog =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ChangeLog 3 Sep 2004 16:56:17 -0000 1.23 --- ChangeLog 3 Sep 2004 17:30:42 -0000 1.24 *************** *** 41,44 **** --- 41,45 ---- - Fixed bug #0000267 (Max. falling height is now infinite). - Fixed bug #0000268 (coord.validspawnspot() now corrects the z value of coordinates) + - Made startup more fault tolerant. Wolfpack 12.9.8 Beta (19. August 2004) |