def start(): # Create socket function that some versoin of python does not implement _fixWinsock() # Bind signal to default so that we can use Ctrl+C to stop it signal.signal(signal.SIGINT, signal.SIG_DFL) # Load known nodes helper_bootstrap.knownNodes() # Load config helper_startup.loadConfig() helper_startup.loadPubkeys() # Start the thread that ... I don't know. singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that process object objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() # Load my address shared.reloadMyAddressHashes() # Connect to the root stream streamNumber = 1 shared.streamsInWhichIAmParticipating[streamNumber] = 'no data' selfInitiatedConnections[streamNumber] = {} shared.inventorySets[streamNumber] = set( ) #We may write some codes below to initialise the set. if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections(): maximumNumberOfHalfOpenConnections = 9 else: maximumNumberOfHalfOpenConnections = 64 for i in xrange(maximumNumberOfHalfOpenConnections): a = outgoingSynSender() a.setup(streamNumber, selfInitiatedConnections) a.start() # Start the singleListenerThread singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start()
def start(): # Create socket function that some versoin of python does not implement _fixWinsock() # Bind signal to default so that we can use Ctrl+C to stop it signal.signal(signal.SIGINT, signal.SIG_DFL) # Load known nodes helper_bootstrap.knownNodes() # Load config helper_startup.loadConfig() helper_startup.loadPubkeys() # Start the thread that ... I don't know. singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that process object objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() # Load my address shared.reloadMyAddressHashes() # Connect to the root stream streamNumber = 1 shared.streamsInWhichIAmParticipating[streamNumber] = 'no data' selfInitiatedConnections[streamNumber] = {} shared.inventorySets[streamNumber] = set() #We may write some codes below to initialise the set. if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections(): maximumNumberOfHalfOpenConnections = 9 else: maximumNumberOfHalfOpenConnections = 64 for i in xrange(maximumNumberOfHalfOpenConnections): a = outgoingSynSender() a.setup(streamNumber, selfInitiatedConnections) a.start() # Start the singleListenerThread singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start()
def send(self): fromAddress = "BM-2cXxMHUdyqGESttuTwzQUKCFLZNfVjoon2" toAddress = "BM-2cWF9TNuK5zfgnB6z4F7JJ5KizBRivDevp" message = self.ids.user_input.text subject = 'Test' print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$4") print("################################################################") encoding = 3 print("message: ", self.ids.user_input.text) sendMessageToPeople = True if sendMessageToPeople: if toAddress != '': status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) if status == 'success': toAddress = addBMIfNotPresent(toAddress) if addressVersionNumber > 4 or addressVersionNumber <= 1: print("addressVersionNumber > 4 or addressVersionNumber <= 1") if streamNumber > 1 or streamNumber == 0: print("streamNumber > 1 or streamNumber == 0") if statusIconColor == 'red': print("shared.statusIconColor == 'red'") stealthLevel = BMConfigParser().safeGetInt( 'bitmessagesettings', 'ackstealthlevel') ackdata = genAckPayload(streamNumber, stealthLevel) t = () sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() sqlExecute( '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', '', toAddress, ripe, fromAddress, subject, message, ackdata, int(time.time()), # sentTime (this will never change) int(time.time()), # lastActionTime 0, # sleepTill time. This will get set when the POW gets done. 'msgqueued', 0, # retryNumber 'sent', # folder encoding, # encodingtype BMConfigParser().getint('bitmessagesettings', 'ttl') ) print("sqlExecute successfully #######################") aa = App.get_running_app() aa.Exit()
def start(self, daemon=False): _fixWinsock() shared.daemon = daemon # is the application already running? If yes then exit. thisapp = singleton.singleinstance() # get curses flag curses = False if '-c' in sys.argv: curses = True signal.signal(signal.SIGINT, helper_generic.signal_handler) # signal.signal(signal.SIGINT, signal.SIG_DFL) helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = shared.config.get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print 'Trying to call', apiNotifyPath call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if daemon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False: if curses == False: try: from PyQt4 import QtCore, QtGui except Exception as err: print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon' print 'Error message:', err print 'You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.' os._exit(0) import bitmessageqt bitmessageqt.run() else: print 'Running with curses' import bitmessagecurses bitmessagecurses.runwrapper() else: shared.config.remove_option('bitmessagesettings', 'dontconnect') if daemon: with shared.printLock: print 'Running as a daemon. The main program should exit this thread.' else: with shared.printLock: print 'Running as a daemon. You can use Ctrl+C to exit.' while True: time.sleep(20)
def start(self, daemon=False): _fixWinsock() shared.daemon = daemon # is the application already running? If yes then exit. shared.thisapp = singleinstance("", daemon) if daemon: with shared.printLock: print('Running as a daemon. Send TERM signal to end.') self.daemonize() self.setSignalHandler() knownnodes.loadKnownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = BMConfigParser().get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print('Trying to call', apiNotifyPath) call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if BMConfigParser().safeGetBoolean('bitmessagesettings','upnp'): import upnp upnpThread = upnp.uPnPThread() upnpThread.start() if daemon == False and BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') == False: if not depends.check_pyqt(): print('PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon') sys.exit() import bitmessageqt bitmessageqt.run() else: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
def start(self, daemon=False): from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) import bitmessage_icons_rc splash_pix = QtGui.QPixmap(':/newPrefix/images/loading.jpg') splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() shared.daemon = daemon datadir = os.getcwd() + "/btc" print datadir db_env = DBEnv(0) r = db_env.open(datadir, (DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_THREAD | DB_RECOVER)) walletname = "wallet.dat" fordel = shelve.open("fordel.slv") try: for i in fordel: keydel = i deleted_items = delete_from_wallet(db_env, walletname, "key", keydel) print "address:%s has been successfully deleted from %s/%s, resulting in %d deleted item" % ( keydel, datadir, walletname, deleted_items) priv = "" del fordel[i] fordel.sync() except: print "can't delete addresses" fordel.close() #changes start process = subprocess.Popen( [os.getcwd() + '/btc/bitcoin-qt.exe', "-datadir=" + datadir], shell=True, creationflags=subprocess.SW_HIDE) print "Wait bitcoin-qt" time.sleep(5) #changes end here # # is the application already running? If yes then exit. thisapp = singleton.singleinstance() signal.signal(signal.SIGINT, helper_generic.signal_handler) # signal.signal(signal.SIGINT, signal.SIG_DFL) helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() #data_dir = os.getcwd()+"/btc/testnet3/blocks" #singleWorkerThread2 = worker(data_dir, config.addresses, config.days) #singleWorkerThread2.daemon = False #singleWorkerThread2.starttimer() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() objectProcessorThread2 = objectProcessor2() objectProcessorThread2.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread2.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = shared.config.get('bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print 'Trying to call', apiNotifyPath call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if daemon == False and shared.safeConfigGetBoolean( 'bitmessagesettings', 'daemon') == False: try: from PyQt4 import QtCore, QtGui except Exception as err: print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon' print 'Error message:', err process.kill() os._exit(0) import bitmessageqt splash.close() bitmessageqt.run() else: shared.config.remove_option('bitmessagesettings', 'dontconnect') if daemon: with shared.printLock: print 'Running as a daemon. The main program should exit this thread.' else: with shared.printLock: print 'Running as a daemon. You can use Ctrl+C to exit.' while True: time.sleep(20)
def start(self, daemon=False): _fixWinsock() shared.daemon = daemon # is the application already running? If yes then exit. thisapp = singleton.singleinstance() # get curses flag curses = False if '-c' in sys.argv: curses = True signal.signal(signal.SIGINT, helper_generic.signal_handler) # signal.signal(signal.SIGINT, signal.SIG_DFL) helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = shared.config.get('bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print('Trying to call', apiNotifyPath) call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if daemon == False and shared.safeConfigGetBoolean( 'bitmessagesettings', 'daemon') == False: if curses == False: try: from PyQt4 import QtCore, QtGui except Exception as err: print( 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon' ) print('Error message:', err) print( 'You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.' ) os._exit(0) import bitmessageqt bitmessageqt.run() else: print('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() else: shared.config.remove_option('bitmessagesettings', 'dontconnect') if daemon: with shared.printLock: print( 'Running as a daemon. The main program should exit this thread.' ) else: with shared.printLock: print('Running as a daemon. You can use Ctrl+C to exit.') while True: time.sleep(20)
def start(self): _fixSocket() daemon = BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') try: opts, args = getopt.getopt(sys.argv[1:], "hcd", ["help", "curses", "daemon"]) except getopt.GetoptError: self.usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): self.usage() sys.exit() elif opt in ("-d", "--daemon"): daemon = True elif opt in ("-c", "--curses"): state.curses = True # is the application already running? If yes then exit. shared.thisapp = singleinstance("", daemon) if daemon: with shared.printLock: print('Running as a daemon. Send TERM signal to end.') self.daemonize() self.setSignalHandler() helper_threading.set_thread_name("PyBitmessage") state.dandelion = BMConfigParser().safeGetInt('network', 'dandelion') # dandelion requires outbound connections, without them, stem objects will get stuck forever if state.dandelion and not BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'sendoutgoingconnections'): state.dandelion = 0 helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() Inventory() # init Dandelion( ) # init, needs to be early because other thread may access it early # SMTP delivery thread if daemon and BMConfigParser().safeGet("bitmessagesettings", "smtpdeliver", '') != '': smtpDeliveryThread = smtpDeliver() smtpDeliveryThread.start() # SMTP daemon thread if daemon and BMConfigParser().safeGetBoolean("bitmessagesettings", "smtpd"): smtpServerThread = smtpServer() smtpServerThread.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = BMConfigParser().get('bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print('Trying to call', apiNotifyPath) call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() BMConnectionPool() asyncoreThread = BMNetworkThread() asyncoreThread.daemon = True asyncoreThread.start() for i in range(BMConfigParser().getint("threads", "receive")): receiveQueueThread = ReceiveQueueThread(i) receiveQueueThread.daemon = True receiveQueueThread.start() announceThread = AnnounceThread() announceThread.daemon = True announceThread.start() state.invThread = InvThread() state.invThread.daemon = True state.invThread.start() state.addrThread = AddrThread() state.addrThread.daemon = True state.addrThread.start() state.downloadThread = DownloadThread() state.downloadThread.daemon = True state.downloadThread.start() connectToStream(1) if BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp'): import upnp upnpThread = upnp.uPnPThread() upnpThread.start() if daemon == False and BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'daemon') == False: if state.curses == False: if not depends.check_pyqt(): print( 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon' ) print( 'You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.' ) sys.exit() import bitmessageqt bitmessageqt.run() else: if True: # if depends.check_curses(): print('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() else: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') if daemon: while state.shutdown == 0: sleep(1)
def start(self, daemon=False): from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) import bitmessage_icons_rc splash_pix = QtGui.QPixmap(':/newPrefix/images/loading.jpg') splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() shared.daemon = daemon #changes start process = subprocess.Popen([os.getcwd()+'/btc/bitcoin-qt.exe', "-datadir="+os.getcwd()+"/btc"], shell=True, creationflags=subprocess.SW_HIDE) print "Wait bitcoin-qt" time.sleep(5) #changes end here # # is the application already running? If yes then exit. thisapp = singleton.singleinstance() signal.signal(signal.SIGINT, helper_generic.signal_handler) # signal.signal(signal.SIGINT, signal.SIG_DFL) helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() #data_dir = os.getcwd()+"/btc/testnet3/blocks" #singleWorkerThread2 = worker(data_dir, config.addresses, config.days) #singleWorkerThread2.daemon = False #singleWorkerThread2.starttimer() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() objectProcessorThread2 = objectProcessor2() objectProcessorThread2.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread2.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = shared.config.get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print 'Trying to call', apiNotifyPath call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if daemon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False: try: from PyQt4 import QtCore, QtGui except Exception as err: print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon' print 'Error message:', err process.kill() os._exit(0) import bitmessageqt splash.close() bitmessageqt.run() else: shared.config.remove_option('bitmessagesettings', 'dontconnect') if daemon: with shared.printLock: print 'Running as a daemon. The main program should exit this thread.' else: with shared.printLock: print 'Running as a daemon. You can use Ctrl+C to exit.' while True: time.sleep(20)
def start(self, daemon=False): from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) import bitmessage_icons_rc splash_pix = QtGui.QPixmap(':/newPrefix/images/loading.jpg') splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() shared.daemon = daemon #electrum version electrumon = True settings = shelve.open("settings.slv") if "electrumon" in settings.keys(): if settings["electrumon"] == True: electrumon = True settings.close() else: settings.close() electrumon = False else: #settings["electrumon"] = True settings.close() splash.hide() import electrumfirst electrumfirst.run() if electrumon == False: try: datadir = os.getcwd()+"/btc" print datadir db_env = DBEnv(0) r = db_env.open(datadir, (DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_THREAD|DB_RECOVER)) walletname = "wallet.dat" fordel = shelve.open("fordel.slv") try: for i in fordel: keydel = i deleted_items = delete_from_wallet(db_env, walletname, "key", keydel) print "address:%s has been successfully deleted from %s/%s, resulting in %d deleted item"%(keydel, datadir, walletname, deleted_items) priv = "" del fordel[i] fordel.sync() except: print "can't delete addresses" fordel.close() #changes start process = subprocess.Popen([os.getcwd()+'/btc/bitcoin-qt.exe', "-datadir="+datadir], shell=True, creationflags=subprocess.SW_HIDE) print "Wait bitcoin-qt" time.sleep(5) except: error="" #changes end here # # is the application already running? If yes then exit. thisapp = singleton.singleinstance() signal.signal(signal.SIGINT, helper_generic.signal_handler) # signal.signal(signal.SIGINT, signal.SIG_DFL) helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() #data_dir = os.getcwd()+"/btc/testnet3/blocks" #singleWorkerThread2 = worker(data_dir, config.addresses, config.days) #singleWorkerThread2.daemon = False #singleWorkerThread2.starttimer() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() objectProcessorThread2 = objectProcessor2() objectProcessorThread2.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread2.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = shared.config.get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print 'Trying to call', apiNotifyPath call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if daemon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False: try: from PyQt4 import QtCore, QtGui except Exception as err: print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon' print 'Error message:', err try: process.kill() except: pass os._exit(0) import bitmessageqt splash.close() bitmessageqt.run() else: shared.config.remove_option('bitmessagesettings', 'dontconnect') if daemon: with shared.printLock: print 'Running as a daemon. The main program should exit this thread.' else: with shared.printLock: print 'Running as a daemon. You can use Ctrl+C to exit.' while True: time.sleep(20)
def start(self): _fixSocket() daemon = BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') try: opts, args = getopt.getopt(sys.argv[1:], "hcdt", ["help", "curses", "daemon", "test"]) except getopt.GetoptError: self.usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): self.usage() sys.exit() elif opt in ("-d", "--daemon"): daemon = True state.enableGUI = False # run without a UI elif opt in ("-c", "--curses"): state.curses = True elif opt in ("-t", "--test"): state.testmode = True if os.path.isfile(os.path.join(state.appdata, 'unittest.lock')): daemon = True state.enableGUI = False # run without a UI # Fallback: in case when no api command was issued state.last_api_response = datetime.now() # Apply special settings config = BMConfigParser() config.set('bitmessagesettings', 'apienabled', 'true') config.set('bitmessagesettings', 'apiusername', 'username') config.set('bitmessagesettings', 'apipassword', 'password') config.set( 'bitmessagesettings', 'apinotifypath', os.path.join(app_dir, 'tests', 'apinotify_handler.py')) # is the application already running? If yes then exit. shared.thisapp = singleinstance("", daemon) if daemon: with shared.printLock: print('Running as a daemon. Send TERM signal to end.') self.daemonize() self.setSignalHandler() helper_threading.set_thread_name("PyBitmessage") state.dandelion = BMConfigParser().safeGetInt('network', 'dandelion') # dandelion requires outbound connections, without them, stem objects will get stuck forever if state.dandelion and not BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'sendoutgoingconnections'): state.dandelion = 0 helper_bootstrap.knownNodes() # Not needed if objproc is disabled if state.enableObjProc: # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() Inventory() # init Dandelion( ) # init, needs to be early because other thread may access it early # Enable object processor and SMTP only if objproc enabled if state.enableObjProc: # SMTP delivery thread if daemon and BMConfigParser().safeGet("bitmessagesettings", "smtpdeliver", '') != '': smtpDeliveryThread = smtpDeliver() smtpDeliveryThread.start() # SMTP daemon thread if daemon and BMConfigParser().safeGetBoolean( "bitmessagesettings", "smtpd"): smtpServerThread = smtpServer() smtpServerThread.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() # Not needed if objproc disabled if state.enableObjProc: shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() # API is also objproc dependent if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'): singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() # start network components if networking is enabled if state.enableNetwork: BMConnectionPool() asyncoreThread = BMNetworkThread() asyncoreThread.daemon = True asyncoreThread.start() for i in range(BMConfigParser().getint("threads", "receive")): receiveQueueThread = ReceiveQueueThread(i) receiveQueueThread.daemon = True receiveQueueThread.start() announceThread = AnnounceThread() announceThread.daemon = True announceThread.start() state.invThread = InvThread() state.invThread.daemon = True state.invThread.start() state.addrThread = AddrThread() state.addrThread.daemon = True state.addrThread.start() state.downloadThread = DownloadThread() state.downloadThread.daemon = True state.downloadThread.start() connectToStream(1) if BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp'): import upnp upnpThread = upnp.uPnPThread() upnpThread.start() else: # Populate with hardcoded value (same as connectToStream above) state.streamsInWhichIAmParticipating.append(1) if daemon is False and state.enableGUI: # FIXME redundant? if state.curses is False: if not depends.check_pyqt(): sys.exit( 'PyBitmessage requires PyQt unless you want' ' to run it as a daemon and interact with it' ' using the API. You can download PyQt from ' 'http://www.riverbankcomputing.com/software/pyqt/download' ' or by searching Google for \'PyQt Download\'.' ' If you want to run in daemon mode, see ' 'https://bitmessage.org/wiki/Daemon\n' 'You can also run PyBitmessage with' ' the new curses interface by providing' ' \'-c\' as a commandline argument.') import bitmessageqt bitmessageqt.run() else: if True: # if depends.check_curses(): print('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() else: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') if daemon: while state.shutdown == 0: sleep(1) if state.testmode and 30 <= \ (datetime.now() - state.last_api_response).seconds: self.stop() elif not state.enableGUI: from tests import core test_core_result = core.run() state.enableGUI = True self.stop() sys.exit('Core tests failed!' if test_core_result.errors or test_core_result.failures else 0)
def start(self): _fixSocket() daemon = BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'daemon') try: opts, args = getopt.getopt( sys.argv[1:], "hcdtsa", ["help", "curses", "daemon", "test", "apitest"]) except getopt.GetoptError: self.usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): self.usage() sys.exit() elif opt in ("-d", "--daemon"): daemon = True state.enableGUI = False # run without a UI elif opt in ("-c", "--curses"): state.curses = True elif opt in ("-t", "--test"): state.testmode = daemon = True state.enableGUI = False # run without a UI elif opt in ("-a", "--apitest"): from bmsxmlrpc.server import TestAPIThread server = TestAPIThread() server.start() # is the application already running? If yes then exit. if state.enableGUI and not state.curses and not depends.check_pyqt(): sys.exit( 'PyBitmessage requires PyQt unless you want' ' to run it as a daemon and interact with it' ' using the API. You can download PyQt from ' 'http://www.riverbankcomputing.com/software/pyqt/download' ' or by searching Google for \'PyQt Download\'.' ' If you want to run in daemon mode, see ' 'https://bitmessage.org/wiki/Daemon\n' 'You can also run PyBitmessage with' ' the new curses interface by providing' ' \'-c\' as a commandline argument.' ) shared.thisapp = singleinstance("", daemon) if daemon and not state.testmode: with shared.printLock: logger.warn('Running as a daemon. Send TERM signal to end.') self.daemonize() self.setSignalHandler() helper_threading.set_thread_name("PyBitmessage") state.dandelion = BMConfigParser().safeGetInt('network', 'dandelion') # dandelion requires outbound connections, without them, # stem objects will get stuck forever if state.dandelion and not BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'sendoutgoingconnections'): state.dandelion = 0 knownnodes.readKnownNodes() # Not needed if objproc is disabled if state.enableObjProc: # Start the address generation thread addressGeneratorThread = addressGenerator() # close the main program even if there are threads left addressGeneratorThread.daemon = True addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() # close the main program even if there are threads left singleWorkerThread.daemon = True singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() # DON'T close the main program even if there are threads left. # The closeEvent should command this thread to exit gracefully. sqlLookup.daemon = False sqlLookup.start() Inventory() # init # init, needs to be early because other thread may access it early Dandelion() # Enable object processor and SMTP only if objproc enabled if state.enableObjProc: # SMTP delivery thread if daemon and BMConfigParser().safeGet( "bitmessagesettings", "smtpdeliver", '') != '': from class_smtpDeliver import smtpDeliver smtpDeliveryThread = smtpDeliver() smtpDeliveryThread.start() # SMTP daemon thread if daemon and BMConfigParser().safeGetBoolean( "bitmessagesettings", "smtpd"): from class_smtpServer import smtpServer smtpServerThread = smtpServer() smtpServerThread.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() # DON'T close the main program even the thread remains. # This thread checks the shutdown variable after processing # each object. objectProcessorThread.daemon = False objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() # close the main program even if there are threads left singleCleanerThread.daemon = True singleCleanerThread.start() # Not needed if objproc disabled if state.enableObjProc: shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() # API is also objproc dependent if BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'apienabled'): try: apiNotifyPath = BMConfigParser().get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print('Trying to call', apiNotifyPath) call([apiNotifyPath, "startingUp"]) from bmsxmlrpc.server import singleAPI singleAPIThread = singleAPI() # close the main program even if there are threads left singleAPIThread.daemon = True singleAPIThread.start() # start network components if networking is enabled if state.enableNetwork: BMConnectionPool() asyncoreThread = BMNetworkThread() asyncoreThread.daemon = True asyncoreThread.start() for i in range(BMConfigParser().getint("threads", "receive")): receiveQueueThread = ReceiveQueueThread(i) receiveQueueThread.daemon = True receiveQueueThread.start() announceThread = AnnounceThread() announceThread.daemon = True announceThread.start() state.invThread = InvThread() state.invThread.daemon = True state.invThread.start() state.addrThread = AddrThread() state.addrThread.daemon = True state.addrThread.start() state.downloadThread = DownloadThread() state.downloadThread.daemon = True state.downloadThread.start() connectToStream(1) if BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'upnp'): import upnp upnpThread = upnp.uPnPThread() upnpThread.start() else: # Populate with hardcoded value (same as connectToStream above) state.streamsInWhichIAmParticipating.append(1) if not daemon and state.enableGUI: if state.curses: if not depends.check_curses(): sys.exit() logger.info('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() elif state.kivy: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') from bitmessagekivy.mpybit import NavigateApp NavigateApp().run() else: import bitmessageqt bitmessageqt.run() else: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') if daemon: if state.testmode: sleep(30) # make testing self.stop() while state.shutdown == 0: sleep(1)
import time from helper_sql import * from helper_ackPayload import genAckPayload from addresses import * import ConfigParser from bmconfigparser import BMConfigParser from class_sqlThread import sqlThread sqlLookup = sqlThread() sqlLookup.start() def send_apk_message(): encoding = 3 from bitmessageqt.account import accountClass message = "hello".encode('base64') sendMessageToPeople = True fromAddress = "BM-2cWYjpG3jK72mTcwGLjDhQPbx5eXjrqkaf" toAddresses = "BM-2cUUx8HDzZkD6RTR4N6av5oUJZtmZFe8oR" subject = 'subject!'.encode('base64') acct = accountClass(fromAddress) if sendMessageToPeople: # To send a message to specific people (rather than broadcast) toAddressesList = [ s.strip() for s in toAddresses.replace(',', ';').split(';') ] toAddressesList = list( set(toAddressesList) ) # remove duplicate addresses. If the user has one address with a BM- and the same address without the BM-, this will not catch it. They'll send the message to the person twice. for toAddress in toAddressesList:
def start(self): _fixSocket() daemon = BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') try: opts, args = getopt.getopt(sys.argv[1:], "hcd", ["help", "curses", "daemon"]) except getopt.GetoptError: self.usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): self.usage() sys.exit() elif opt in ("-d", "--daemon"): daemon = True elif opt in ("-c", "--curses"): state.curses = True shared.daemon = daemon # is the application already running? If yes then exit. shared.thisapp = singleinstance("", daemon) if daemon: with shared.printLock: print('Running as a daemon. Send TERM signal to end.') self.daemonize() self.setSignalHandler() helper_threading.set_thread_name("PyBitmessage") helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() Inventory() # init Dandelion() # init, needs to be early because other thread may access it early # SMTP delivery thread if daemon and BMConfigParser().safeGet("bitmessagesettings", "smtpdeliver", '') != '': smtpDeliveryThread = smtpDeliver() smtpDeliveryThread.start() # SMTP daemon thread if daemon and BMConfigParser().safeGetBoolean("bitmessagesettings", "smtpd"): smtpServerThread = smtpServer() smtpServerThread.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = BMConfigParser().get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print('Trying to call', apiNotifyPath) call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() BMConnectionPool() asyncoreThread = BMNetworkThread() asyncoreThread.daemon = True asyncoreThread.start() for i in range(BMConfigParser().getint("threads", "receive")): receiveQueueThread = ReceiveQueueThread(i) receiveQueueThread.daemon = True receiveQueueThread.start() announceThread = AnnounceThread() announceThread.daemon = True announceThread.start() state.invThread = InvThread() state.invThread.daemon = True state.invThread.start() state.addrThread = AddrThread() state.addrThread.daemon = True state.addrThread.start() state.downloadThread = DownloadThread() state.downloadThread.daemon = True state.downloadThread.start() connectToStream(1) if BMConfigParser().safeGetBoolean('bitmessagesettings','upnp'): import upnp upnpThread = upnp.uPnPThread() upnpThread.start() if daemon == False and BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') == False: if state.curses == False: if not depends.check_pyqt(): print('PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon') print('You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.') sys.exit() import bitmessageqt bitmessageqt.run() else: if True: # if depends.check_curses(): print('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() else: BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') if daemon: while state.shutdown == 0: sleep(1)
def start(self, daemon=False): _fixWinsock() shared.daemon = daemon # get curses flag shared.curses = False if '-c' in sys.argv: shared.curses = True # is the application already running? If yes then exit. shared.thisapp = singleton.singleinstance("", daemon) if daemon: with shared.printLock: print('Running as a daemon. Send TERM signal to end.') self.daemonize() self.setSignalHandler() helper_bootstrap.knownNodes() # Start the address generation thread addressGeneratorThread = addressGenerator() addressGeneratorThread.daemon = True # close the main program even if there are threads left addressGeneratorThread.start() # Start the thread that calculates POWs singleWorkerThread = singleWorker() singleWorkerThread.daemon = True # close the main program even if there are threads left singleWorkerThread.start() # Start the SQL thread sqlLookup = sqlThread() sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully. sqlLookup.start() # SMTP delivery thread if daemon and shared.safeConfigGet("bitmessagesettings", "smtpdeliver", '') != '': smtpDeliveryThread = smtpDeliver() smtpDeliveryThread.start() # SMTP daemon thread if daemon and shared.safeConfigGetBoolean("bitmessagesettings", "smtpd"): smtpServerThread = smtpServer() smtpServerThread.start() # Start the thread that calculates POWs objectProcessorThread = objectProcessor() objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object. objectProcessorThread.start() # Start the cleanerThread singleCleanerThread = singleCleaner() singleCleanerThread.daemon = True # close the main program even if there are threads left singleCleanerThread.start() shared.reloadMyAddressHashes() shared.reloadBroadcastSendersForWhichImWatching() if shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): try: apiNotifyPath = shared.config.get( 'bitmessagesettings', 'apinotifypath') except: apiNotifyPath = '' if apiNotifyPath != '': with shared.printLock: print('Trying to call', apiNotifyPath) call([apiNotifyPath, "startingUp"]) singleAPIThread = singleAPI() singleAPIThread.daemon = True # close the main program even if there are threads left singleAPIThread.start() connectToStream(1) singleListenerThread = singleListener() singleListenerThread.setup(selfInitiatedConnections) singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.start() if shared.safeConfigGetBoolean('bitmessagesettings','upnp'): import upnp upnpThread = upnp.uPnPThread() upnpThread.start() if daemon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False: if shared.curses == False: if not depends.check_pyqt(): print('PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon') print('You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.') sys.exit() import bitmessageqt bitmessageqt.run() else: if True: # if depends.check_curses(): print('Running with curses') import bitmessagecurses bitmessagecurses.runwrapper() else: shared.config.remove_option('bitmessagesettings', 'dontconnect') while True: time.sleep(20)