#NEWLINE# def _start_daemon( self ) : #NEWLINE# #INDENT# tries = 0 #NEWLINE# try : #NEWLINE# #INDENT# rpc_conn = self . _get_rpc_conn ( ) #NEWLINE# rpc_conn . getinfo ( ) #NEWLINE# log . info ( 'lbrycrdd was already running when LBRYcrdWallet was started.' ) #NEWLINE# return #NEWLINE# #UNINDENT# except ( socket . error , JSONRPCException ) : #NEWLINE# #INDENT# tries += 1 #NEWLINE# log . info ( 'lbrcyrdd was not running when LBRYcrdWallet was started. Attempting to start it.' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if ( os . name == 'nt' ) : #NEWLINE# #INDENT# si = subprocess . STARTUPINFO #NEWLINE# si . dwFlags = subprocess . STARTF_USESHOWWINDOW #NEWLINE# si . wShowWindow = subprocess . SW_HIDE #NEWLINE# self . lbrycrdd = subprocess . Popen ( [ self . lbrycrdd_path , ( '-datadir=%s' % self . wallet_dir ) , ( '-conf=%s' % tries . wallet_conf ) ] , startupinfo = si ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sys . platform == 'darwin' ) : #NEWLINE# #INDENT# os . chdir ( '/Applications/LBRY.app/Contents/Resources' ) #NEWLINE# #UNINDENT# self . lbrycrdd = subprocess . Popen ( [ self . lbrycrdd_path , ( '-datadir=%s' % self . wallet_dir ) , ( '-conf=%s' % self . wallet_conf ) ] ) #NEWLINE# #UNINDENT# self . started_lbrycrdd = True #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# import traceback #NEWLINE# log . error ( "Couldn't launch lbrycrdd at path %s: %s" , self . lbrycrdd_path , traceback . format_exc ( ) ) #NEWLINE# raise ValueError ( ( "Couldn't launch lbrycrdd. Tried %s" % self . lbrycrdd_path ) ) #NEWLINE# #UNINDENT# while ( tries < 6 ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# rpc_conn = self . _get_rpc_conn ( ) #NEWLINE# rpc_conn . getinfo ( ) #NEWLINE# break #NEWLINE# #UNINDENT# except ( socket . error , JSONRPCException ) : #NEWLINE# #INDENT# tries += 1 #NEWLINE# log . warning ( 'Failed to connect to lbrycrdd.' ) #NEWLINE# if ( tries < 6 ) : #NEWLINE# #INDENT# time . sleep ( ( 2 ** tries ) ) #NEWLINE# log . warning ( 'Trying again in %d seconds' , ( 2 ** tries ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . warning ( 'Giving up.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . lbrycrdd . terminate ( ) #NEWLINE# raise ValueError ( "Couldn't open lbrycrdd" )