def getFunnelURL(self): if patcherVer() == ['OFFLINE']: return if not patcherVer(): patcherHTTP = HTTPClient() if checkParamFile() == None: patcherDoc = patcherHTTP.getDocument(URLSpec('http://download.toontown.com/english/currentVersion/content/patcher.ver')) vconGroup('w', self.cgRelease) else: patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile())) vconGroup('w', self.cgBeta) rf = Ramfile() patcherDoc.downloadToRam(rf) self.patcherURL = rf.getData() if self.patcherURL.find('FUNNEL_LOG') == -1: patcherVer('w', 'OFFLINE') return self.patcherURL = self.patcherURL.split('\n') del rf del patcherDoc del patcherHTTP while self.patcherURL: self.confLine = self.patcherURL.pop() if self.confLine.find('FUNNEL_LOG=') != -1 and self.confLine.find('#FUNNEL_LOG=') == -1: self.dynamicVRFunnel = self.confLine[11:].strip('\n') patcherVer('w', self.confLine[11:].strip('\n')) else: self.dynamicVRFunnel = patcherVer()[0] return
def reportMemoryLeaks(): if printUnreachableNum() == 0: return import bz2, gc gc.set_debug(gc.DEBUG_SAVEALL) gc.collect() uncompressedReport = '' for s in gc.garbage: try: uncompressedReport += str(s) + '&' except TypeError: pass reportdata = bz2.compress(uncompressedReport, 9) headers = {'Content-type': 'application/x-bzip2', 'Accept': 'text/plain'} try: baseURL = patcherVer()[0].split('/lo')[0] except IndexError: print 'Base URL not available for leak submit' return basePort = 80 if baseURL.count(':') == 2: basePort = baseURL[-4:] baseURL = baseURL[:-5] baseURL = baseURL[7:] if basePort != 80: finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum()) else: finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum()) reporthttp = HTTPClient() reporthttp.postForm(URLSpec(finalURL), reportdata)
def __init__(self): dcFileNames = ['distributed/direct.dc', 'distributed/net.dc'] ClientRepository.__init__(self, dcFileNames = dcFileNames, dcSuffix = 'AI') tcpPort = base.config.GetInt('server-port', 4400) url = URLSpec('http://127.0.0.1:%s' % (tcpPort)) self.connect([url], successCallback = self.connectSuccess, failureCallback = self.connectFailure)
def getFunnelURL(self): # print 'VRS URL: ' + self.dynamicVRFunnel if (patcherVer() == ['OFFLINE']): # print "Funnel System Offline" return if (patcherVer() == []): # print "Funnel URL not set. Setting now" patcherHTTP = HTTPClient() if checkParamFile() == None: patcherDoc = patcherHTTP.getDocument( URLSpec( 'http://download.toontown.com/english/currentVersion/content/patcher.ver' )) # Now set vcon (Content Group) to the Release string vconGroup('w', self.cgRelease) else: patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile())) # Set vcon (Content Group) to the Beta string vconGroup('w', self.cgBeta) # patcherDoc = patcherHTTP.getDocument(URLSpec('http://build64:3120/english/currentVersion/dev/content/patcher.ver')) rf = Ramfile() patcherDoc.downloadToRam(rf) self.patcherURL = rf.getData() if self.patcherURL.find('FUNNEL_LOG') == -1: # The file did not download, need to set # the patcherVer to offline patcherVer('w', 'OFFLINE') # print 'Patcher system could not be reached' return self.patcherURL = self.patcherURL.split('\n') del rf, patcherDoc, patcherHTTP while self.patcherURL: self.confLine = self.patcherURL.pop() if (self.confLine.find('FUNNEL_LOG=') != -1 and self.confLine.find('#FUNNEL_LOG=') == -1): self.dynamicVRFunnel = self.confLine[11:].strip('\n') patcherVer('w', self.confLine[11:].strip('\n')) else: self.dynamicVRFunnel = patcherVer()[0]
def __init__(self, host, dirnode): self.host = host self.pathname = dirnode.pathname self.totalSize = dirnode.getTotalSize() self.packages = [] if self.host: self.hostUrl = self.host.hostUrl self.descriptiveName = self.host.descriptiveName if not self.descriptiveName: self.descriptiveName = URLSpec(self.hostUrl).getServer() else: self.hostUrl = 'unknown' self.descriptiveName = 'unknown'
def reportMemoryLeaks(): # First check to make sure we are leaking, if number of leaks = 0, we can return if printUnreachableNum() == 0: return # If we made it this far, then some sort of leaking has happened. # For this, we will need the bz2(compression), gc(access to garbage list) modules import bz2, gc # import httplib gc.set_debug(gc.DEBUG_SAVEALL) gc.collect() uncompressedReport = '' for s in gc.garbage: try: uncompressedReport += str(s) + '&' except TypeError: # __repr__ is probably trying to return a non-string pass reportdata = bz2.compress(uncompressedReport, 9) headers = {"Content-type": "application/x-bzip2", "Accept": "text/plain"} # Need to split patcherVer()[0] to just get the base url and port try: baseURL = patcherVer()[0].split('/lo')[0] except IndexError: print 'Base URL not available for leak submit' return basePort = 80 if baseURL.count(':') == 2: basePort = baseURL[-4:] baseURL = baseURL[:-5] baseURL = baseURL[7:] if basePort != 80: finalURL = 'http://' + baseURL + ':' + str( basePort) + '/logging/memory_leak.php?leakcount=' + str( printUnreachableNum()) else: finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str( printUnreachableNum()) reporthttp = HTTPClient() reporthttp.postForm(URLSpec(finalURL), reportdata) return
def __init__(self, ip): """ Default constructor for the Clinet class """ # get the port number from the configuration file # if it doesn't exist, use 4400 as the default tcpPort = base.config.GetInt('server-port', 4400) # get the host name from the configuration file # which we want to connect to. If it doesn't exit # we use loopback to connect to hostname = base.config.GetString('server-host', ip) # now build the url from the data given above self.url = URLSpec('http://%s:%s' % (hostname, tcpPort)) # create the Repository for the client self.cr = DungeonClientRepository() # and finaly try to connect to the server self.cr.connect([self.url], successCallback=self.connectSuccess, failureCallback=self.connectFailure)
except IndexError: print 'Base URL not available for leak submit' return None basePort = 80 if baseURL.count(':') == 2: basePort = baseURL[-4:] baseURL = baseURL[:-5] baseURL = baseURL[7:] if basePort != 80: finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum()) else: finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum()) reporthttp = HTTPClient() reporthttp.postForm(URLSpec(finalURL), reportdata) def checkParamFile(): if os.path.exists('parameters.txt') == 1: paramfile = open('parameters.txt', 'r') contents = paramfile.read() paramfile.close() del paramfile contents = contents.split('\n') newURL = '' while contents: checkLine = contents.pop() if checkLine.find('PATCHER_BASE_URL=') != -1 and checkLine[0] == 'P': newURL = checkLine.split('=')[1] newURL = newURL.replace(' ', '')