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

@ -15,7 +15,8 @@ import singleton
import os
from SimpleXMLRPCServer import SimpleXMLRPCServer
from api import MySimpleXMLRPCRequestHandler
from api import MySimpleXMLRPCRequestHandler
from helper_startup import isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections
import shared
from helper_sql import sqlQuery
@ -59,10 +60,12 @@ def connectToStream(streamNumber):
for row in queryData:
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
else:
maximumNumberOfHalfOpenConnections = 32
maximumNumberOfHalfOpenConnections = 64
for i in range(maximumNumberOfHalfOpenConnections):
a = outgoingSynSender()
a.setup(streamNumber, selfInitiatedConnections)

View File

@ -5,6 +5,8 @@ import os
import locale
import random
import string
import platform
from distutils.version import StrictVersion
from namecoin import ensureNamecoinOptions
@ -119,3 +121,13 @@ def loadConfig():
os.umask(0o077)
with open(shared.appdata + 'keys.dat', 'wb') as 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