From: <Blu...@us...> - 2010-09-15 17:45:30
|
Revision: 406 http://virtplayground.svn.sourceforge.net/virtplayground/?rev=406&view=rev Author: BlueWolf_ Date: 2010-09-15 17:45:24 +0000 (Wed, 15 Sep 2010) Log Message: ----------- Added a proper config for the core and made a lock for the database Modified Paths: -------------- trunk/server/VPS.py trunk/server/core/server.py trunk/server/database.py trunk/server/functions.py Modified: trunk/server/VPS.py =================================================================== --- trunk/server/VPS.py 2010-09-14 21:23:27 UTC (rev 405) +++ trunk/server/VPS.py 2010-09-15 17:45:24 UTC (rev 406) @@ -90,7 +90,9 @@ log('debug', "Done, found %s landscapes." % len(landscapes.list)) - server = core.Server(config, Callback()) + server = core.Server({ + "max-connections": 100 + }, Callback()) server.start_server() # Now we sit back and let the server do its stuff. Only stop at Modified: trunk/server/core/server.py =================================================================== --- trunk/server/core/server.py 2010-09-14 21:23:27 UTC (rev 405) +++ trunk/server/core/server.py 2010-09-15 17:45:24 UTC (rev 406) @@ -54,7 +54,7 @@ The port the server should listen on. Should be int between 1 and 65535. Note that everything lower than 100 usually needs to be run as root under Unix/Linux. - Default is 5162. + Default is 6653. -max_connections: Maximum amount of clients that can be connected simultaneously. Modified: trunk/server/database.py =================================================================== --- trunk/server/database.py 2010-09-14 21:23:27 UTC (rev 405) +++ trunk/server/database.py 2010-09-15 17:45:24 UTC (rev 406) @@ -15,7 +15,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import sys +import sys, threading try: import MySQLdb except: sys.exit("ERROR: You need the MySQLdb-module for this to work!") @@ -26,7 +26,8 @@ self.host = host self.database = database self.user = user - self.passwd = passwd + self.passwd = passwd + self.lock = threading.Lock() self._connect() @@ -56,6 +57,8 @@ # Uncomment for mysql-debugging! #print '\tMySQLdb.' + attr + repr(arg) + + self.lock.acquire() func = getattr(self.db, attr) try: @@ -67,7 +70,10 @@ dbfunc = func(*arg) else: # Some other error we don't care about raise MySQLdb.OperationalError, message - + + finally: + self.lock.release() + return dbfunc return exc Modified: trunk/server/functions.py =================================================================== --- trunk/server/functions.py 2010-09-14 21:23:27 UTC (rev 405) +++ trunk/server/functions.py 2010-09-15 17:45:24 UTC (rev 406) @@ -16,7 +16,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import os, sys, time, hashlib -from getpass import getpass +from getpass import getpass import database from filetable import FileTable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |