commit
4f9dc9d720
|
@ -859,6 +859,7 @@ if shared.useVeryEasyProofOfWorkForTesting:
|
|||
|
||||
class Main:
|
||||
def start(self, daemon=False):
|
||||
shared.daemon = daemon
|
||||
# is the application already running? If yes then exit.
|
||||
thisapp = singleton.singleinstance()
|
||||
|
||||
|
|
|
@ -431,6 +431,8 @@ class MyForm(QtGui.QMainWindow):
|
|||
"rerenderSubscriptions()"), self.rerenderSubscriptions)
|
||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||
"removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid)
|
||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||
"displayAlert(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayAlert)
|
||||
self.UISignalThread.start()
|
||||
|
||||
# Below this point, it would be good if all of the necessary global data
|
||||
|
@ -1406,6 +1408,12 @@ class MyForm(QtGui.QMainWindow):
|
|||
self.ui.tableWidgetInbox.removeRow(i)
|
||||
break
|
||||
|
||||
def displayAlert(self, title, text, exitAfterUserClicksOk):
|
||||
self.statusBar().showMessage(text)
|
||||
QtGui.QMessageBox.critical(self, title, text, QMessageBox.Ok)
|
||||
if exitAfterUserClicksOk:
|
||||
os._exit(0)
|
||||
|
||||
def rerenderInboxFromLabels(self):
|
||||
for i in range(self.ui.tableWidgetInbox.rowCount()):
|
||||
addressToLookup = str(self.ui.tableWidgetInbox.item(
|
||||
|
@ -2291,7 +2299,15 @@ class MyForm(QtGui.QMainWindow):
|
|||
else:
|
||||
self.ui.labelFrom.setText(toAddressAtCurrentInboxRow)
|
||||
self.setBroadcastEnablementDependingOnWhetherThisIsAChanAddress(toAddressAtCurrentInboxRow)
|
||||
|
||||
self.ui.lineEditTo.setText(str(fromAddressAtCurrentInboxRow))
|
||||
|
||||
# If the previous message was to a chan then we should send our reply to the chan rather than to the particular person who sent the message.
|
||||
if shared.config.has_section(toAddressAtCurrentInboxRow):
|
||||
if shared.safeConfigGetBoolean(toAddressAtCurrentInboxRow, 'chan'):
|
||||
print 'original sent to a chan. Setting the to address in the reply to the chan address.'
|
||||
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
|
||||
|
||||
self.ui.comboBoxSendFrom.setCurrentIndex(0)
|
||||
# self.ui.comboBoxSendFrom.setEditText(str(self.ui.tableWidgetInbox.item(currentInboxRow,0).text))
|
||||
self.ui.textEditMessage.setText('\n\n------------------------------------------------------\n' + self.ui.tableWidgetInbox.item(
|
||||
|
@ -3189,6 +3205,9 @@ class UISignaler(QThread):
|
|||
self.emit(SIGNAL("rerenderSubscriptions()"))
|
||||
elif command == 'removeInboxRowByMsgid':
|
||||
self.emit(SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), data)
|
||||
elif command == 'alert':
|
||||
title, text, exitAfterUserClicksOk = data
|
||||
self.emit(SIGNAL("displayAlert(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), title, text, exitAfterUserClicksOk)
|
||||
else:
|
||||
sys.stderr.write(
|
||||
'Command sent to UISignaler not recognized: %s\n' % command)
|
||||
|
|
|
@ -1772,8 +1772,15 @@ class receiveDataThread(threading.Thread):
|
|||
if needToWriteKnownNodesToDisk: # Runs if any nodes were new to us. Also, share those nodes with our peers.
|
||||
shared.knownNodesLock.acquire()
|
||||
output = open(shared.appdata + 'knownnodes.dat', 'wb')
|
||||
pickle.dump(shared.knownNodes, output)
|
||||
output.close()
|
||||
try:
|
||||
pickle.dump(shared.knownNodes, output)
|
||||
output.close()
|
||||
except Exception as err:
|
||||
if "Errno 28" in str(err):
|
||||
logger.fatal('(while receiveDataThread needToWriteKnownNodesToDisk) Alert: Your disk or data storage volume is full. ')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
shared.knownNodesLock.release()
|
||||
self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers)
|
||||
with shared.printLock:
|
||||
|
|
|
@ -7,6 +7,7 @@ import sys
|
|||
import os
|
||||
from debug import logger
|
||||
from namecoin import ensureNamecoinOptions
|
||||
import tr#anslate
|
||||
|
||||
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
||||
# submit queries to it and it puts results back in a different queue. They
|
||||
|
@ -230,7 +231,15 @@ class sqlThread(threading.Thread):
|
|||
logger.fatal('PyBitmessage will now exit very abruptly. You may now see threading errors related to this abrupt exit but the problem you need to solve is related to SQLite.\n\n')
|
||||
os._exit(0)
|
||||
except Exception as err:
|
||||
logger.error(err)
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(While null value test) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
else:
|
||||
logger.error(err)
|
||||
|
||||
# Let us check to see the last time we vaccumed the messages.dat file.
|
||||
# If it has been more than a month let's do it now.
|
||||
|
@ -242,7 +251,16 @@ class sqlThread(threading.Thread):
|
|||
value, = row
|
||||
if int(value) < int(time.time()) - 2592000:
|
||||
logger.info('It has been a long time since the messages.dat file has been vacuumed. Vacuuming now...')
|
||||
self.cur.execute( ''' VACUUM ''')
|
||||
try:
|
||||
self.cur.execute( ''' VACUUM ''')
|
||||
except Exception as err:
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(While VACUUM) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
item = '''update settings set value=? WHERE key='lastvacuumtime';'''
|
||||
parameters = (int(time.time()),)
|
||||
self.cur.execute(item, parameters)
|
||||
|
@ -250,7 +268,16 @@ class sqlThread(threading.Thread):
|
|||
while True:
|
||||
item = shared.sqlSubmitQueue.get()
|
||||
if item == 'commit':
|
||||
self.conn.commit()
|
||||
try:
|
||||
self.conn.commit()
|
||||
except Exception as err:
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(While committing) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
elif item == 'exit':
|
||||
self.conn.close()
|
||||
logger.info('sqlThread exiting gracefully.')
|
||||
|
@ -259,7 +286,16 @@ class sqlThread(threading.Thread):
|
|||
elif item == 'movemessagstoprog':
|
||||
logger.debug('the sqlThread is moving the messages.dat file to the local program directory.')
|
||||
|
||||
self.conn.commit()
|
||||
try:
|
||||
self.conn.commit()
|
||||
except Exception as err:
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(while movemessagstoprog) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
self.conn.close()
|
||||
shutil.move(
|
||||
shared.lookupAppdataFolder() + 'messages.dat', 'messages.dat')
|
||||
|
@ -269,7 +305,16 @@ class sqlThread(threading.Thread):
|
|||
elif item == 'movemessagstoappdata':
|
||||
logger.debug('the sqlThread is moving the messages.dat file to the Appdata folder.')
|
||||
|
||||
self.conn.commit()
|
||||
try:
|
||||
self.conn.commit()
|
||||
except Exception as err:
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(while movemessagstoappdata) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
self.conn.close()
|
||||
shutil.move(
|
||||
'messages.dat', shared.lookupAppdataFolder() + 'messages.dat')
|
||||
|
@ -280,7 +325,16 @@ class sqlThread(threading.Thread):
|
|||
self.cur.execute('''delete from inbox where folder='trash' ''')
|
||||
self.cur.execute('''delete from sent where folder='trash' ''')
|
||||
self.conn.commit()
|
||||
self.cur.execute( ''' VACUUM ''')
|
||||
try:
|
||||
self.cur.execute( ''' VACUUM ''')
|
||||
except Exception as err:
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(while deleteandvacuume) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
else:
|
||||
parameters = shared.sqlSubmitQueue.get()
|
||||
# print 'item', item
|
||||
|
@ -288,8 +342,16 @@ class sqlThread(threading.Thread):
|
|||
try:
|
||||
self.cur.execute(item, parameters)
|
||||
except Exception as err:
|
||||
logger.fatal('Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "%s" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: %s. Here is the actual error message thrown by the sqlThread: %s', str(item), str(repr(parameters)), str(err))
|
||||
logger.fatal('This program shall now abruptly exit!')
|
||||
if str(err) == 'database or disk is full':
|
||||
logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
|
||||
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
|
||||
if shared.daemon:
|
||||
os._exit(0)
|
||||
else:
|
||||
return
|
||||
else:
|
||||
logger.fatal('Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "%s" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: %s. Here is the actual error message thrown by the sqlThread: %s', str(item), str(repr(parameters)), str(err))
|
||||
logger.fatal('This program shall now abruptly exit!')
|
||||
|
||||
os._exit(0)
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ numberOfMessagesProcessed = 0
|
|||
numberOfBroadcastsProcessed = 0
|
||||
numberOfPubkeysProcessed = 0
|
||||
numberOfInventoryLookupsPerformed = 0
|
||||
daemon = False
|
||||
|
||||
#If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them!
|
||||
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
|
||||
|
|
Loading…
Reference in New Issue
Block a user