This commit is contained in:
Jonathan Warren 2014-01-20 15:25:02 -05:00
parent 89d778528a
commit c98ca590a8
2 changed files with 18 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import os
from SimpleXMLRPCServer import SimpleXMLRPCServer from SimpleXMLRPCServer import SimpleXMLRPCServer
from api import MySimpleXMLRPCRequestHandler from api import MySimpleXMLRPCRequestHandler
from helper_startup import isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections
import shared import shared
from helper_sql import sqlQuery from helper_sql import sqlQuery
@ -59,10 +60,12 @@ def connectToStream(streamNumber):
for row in queryData: for row in queryData:
shared.inventorySets[streamNumber].add(row[0]) shared.inventorySets[streamNumber].add(row[0])
if sys.platform[0:3] == 'win':
if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections():
# Some XP and Vista systems can only have 10 outgoing connections at a time.
maximumNumberOfHalfOpenConnections = 9 maximumNumberOfHalfOpenConnections = 9
else: else:
maximumNumberOfHalfOpenConnections = 32 maximumNumberOfHalfOpenConnections = 64
for i in range(maximumNumberOfHalfOpenConnections): for i in range(maximumNumberOfHalfOpenConnections):
a = outgoingSynSender() a = outgoingSynSender()
a.setup(streamNumber, selfInitiatedConnections) a.setup(streamNumber, selfInitiatedConnections)

View File

@ -5,6 +5,8 @@ import os
import locale import locale
import random import random
import string import string
import platform
from distutils.version import StrictVersion
from namecoin import ensureNamecoinOptions from namecoin import ensureNamecoinOptions
@ -119,3 +121,13 @@ def loadConfig():
os.umask(0o077) os.umask(0o077)
with open(shared.appdata + 'keys.dat', 'wb') as configfile: with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile) shared.config.write(configfile)
def isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections():
try:
VER_THIS=StrictVersion(platform.version())
if sys.platform[0:3]=="win":
return StrictVersion("5.1.2600")<VER_THIS and StrictVersion("6.0.6000")>VER_THIS
return False
except Exception as err:
print 'An Exception occurred within isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections:', err
return False