MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / start

Method start

src/bitmessagemain.py:201–345  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

199
200class Main:
201 def start(self):
202 _fixSocket()
203
204 daemon = BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon')
205
206 try:
207 opts, args = getopt.getopt(sys.argv[1:], "hcd",
208 ["help", "curses", "daemon"])
209
210 except getopt.GetoptError:
211 self.usage()
212 sys.exit(2)
213
214 for opt, arg in opts:
215 if opt in ("-h", "--help"):
216 self.usage()
217 sys.exit()
218 elif opt in ("-d", "--daemon"):
219 daemon = True
220 elif opt in ("-c", "--curses"):
221 state.curses = True
222
223 # is the application already running? If yes then exit.
224 shared.thisapp = singleinstance("", daemon)
225
226 if daemon:
227 with shared.printLock:
228 print('Running as a daemon. Send TERM signal to end.')
229 self.daemonize()
230
231 self.setSignalHandler()
232
233 helper_threading.set_thread_name("PyBitmessage")
234
235 state.dandelion = BMConfigParser().safeGetInt('network', 'dandelion')
236 # dandelion requires outbound connections, without them, stem objects will get stuck forever
237 if state.dandelion and not BMConfigParser().safeGetBoolean('bitmessagesettings', 'sendoutgoingconnections'):
238 state.dandelion = 0
239
240 helper_bootstrap.knownNodes()
241 # Start the address generation thread
242 addressGeneratorThread = addressGenerator()
243 addressGeneratorThread.daemon = True # close the main program even if there are threads left
244 addressGeneratorThread.start()
245
246 # Start the thread that calculates POWs
247 singleWorkerThread = singleWorker()
248 singleWorkerThread.daemon = True # close the main program even if there are threads left
249 singleWorkerThread.start()
250
251 # Start the SQL thread
252 sqlLookup = sqlThread()
253 sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully.
254 sqlLookup.start()
255
256 Inventory() # init
257 Dandelion() # init, needs to be early because other thread may access it early
258

Callers 11

mainFunction · 0.95
__init__Method · 0.80
runMethod · 0.80
runServerFunction · 0.80
runMethod · 0.80
__init__Method · 0.80
initializePageMethod · 0.80
__init__Method · 0.80
click_actionSettingsMethod · 0.80
startUpdateMethod · 0.80
resetlookupsFunction · 0.80

Calls 15

usageMethod · 0.95
daemonizeMethod · 0.95
setSignalHandlerMethod · 0.95
BMConfigParserClass · 0.90
singleinstanceClass · 0.90
addressGeneratorClass · 0.90
singleWorkerClass · 0.90
sqlThreadClass · 0.90
InventoryClass · 0.90
DandelionClass · 0.90
smtpDeliverClass · 0.90
smtpServerClass · 0.90

Tested by

no test coverage detected