initilize the ackdataForWhichImWatching data structure within the single worker thread
This commit is contained in:
parent
816967dd98
commit
483e51ad04
|
@ -2626,7 +2626,7 @@ class singleWorker(threading.Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT toripe FROM sent WHERE (status='awaitingpubkey' AND folder='sent')''')
|
shared.sqlSubmitQueue.put('''SELECT toripe FROM sent WHERE ((status='awaitingpubkey' OR status='doingpubkeypow') AND folder='sent')''')
|
||||||
shared.sqlSubmitQueue.put('')
|
shared.sqlSubmitQueue.put('')
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
|
@ -2634,6 +2634,17 @@ class singleWorker(threading.Thread):
|
||||||
toripe, = row
|
toripe, = row
|
||||||
neededPubkeys[toripe] = 0
|
neededPubkeys[toripe] = 0
|
||||||
|
|
||||||
|
#Initialize the ackdataForWhichImWatching data structure using data from the sql database.
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
shared.sqlSubmitQueue.put('''SELECT ackdata FROM sent where (status='msgsent' OR status='doingmsgpow')''')
|
||||||
|
shared.sqlSubmitQueue.put('')
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlLock.release()
|
||||||
|
for row in queryreturn:
|
||||||
|
ackdata, = row
|
||||||
|
print 'Watching for ackdata', ackdata.encode('hex')
|
||||||
|
ackdataForWhichImWatching[ackdata] = 0
|
||||||
|
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT DISTINCT toaddress FROM sent WHERE (status='doingpubkeypow' AND folder='sent')''')
|
shared.sqlSubmitQueue.put('''SELECT DISTINCT toaddress FROM sent WHERE (status='doingpubkeypow' AND folder='sent')''')
|
||||||
shared.sqlSubmitQueue.put('')
|
shared.sqlSubmitQueue.put('')
|
||||||
|
@ -2643,7 +2654,7 @@ class singleWorker(threading.Thread):
|
||||||
toaddress, = row
|
toaddress, = row
|
||||||
self.requestPubKey(toaddress)
|
self.requestPubKey(toaddress)
|
||||||
|
|
||||||
time.sleep(10) #give some time for the GUI to start before we start on any existing POW tasks.
|
time.sleep(10) #give some time for the GUI to start before we start on existing POW tasks.
|
||||||
|
|
||||||
self.sendMsg() #just in case there are any pending tasks for msg messages that have yet to be sent.
|
self.sendMsg() #just in case there are any pending tasks for msg messages that have yet to be sent.
|
||||||
self.sendBroadcast() #just in case there are any tasks for Broadcasts that have yet to be sent.
|
self.sendBroadcast() #just in case there are any tasks for Broadcasts that have yet to be sent.
|
||||||
|
@ -2950,7 +2961,7 @@ class singleWorker(threading.Thread):
|
||||||
def sendMsg(self):
|
def sendMsg(self):
|
||||||
#Check to see if there are any messages queued to be sent
|
#Check to see if there are any messages queued to be sent
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT toaddress FROM sent WHERE (status='msgqueued' AND folder='sent')''')
|
shared.sqlSubmitQueue.put('''SELECT DISTINCT toaddress FROM sent WHERE (status='msgqueued' AND folder='sent')''')
|
||||||
shared.sqlSubmitQueue.put('')
|
shared.sqlSubmitQueue.put('')
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
|
@ -3194,6 +3205,11 @@ class singleWorker(threading.Thread):
|
||||||
|
|
||||||
def requestPubKey(self,toAddress):
|
def requestPubKey(self,toAddress):
|
||||||
toStatus,addressVersionNumber,streamNumber,ripe = decodeAddress(toAddress)
|
toStatus,addressVersionNumber,streamNumber,ripe = decodeAddress(toAddress)
|
||||||
|
if toStatus != 'success':
|
||||||
|
shared.printLock.acquire()
|
||||||
|
sys.stderr.write('Very abnormal error occurred in requestPubKey. toAddress is: '+repr(toAddress)+'. Please report this error to Atheros.')
|
||||||
|
shared.printLock.release()
|
||||||
|
return
|
||||||
neededPubkeys[ripe] = 0
|
neededPubkeys[ripe] = 0
|
||||||
payload = pack('>I',(int(time.time())+random.randrange(-300, 300)))#the current time plus or minus five minutes.
|
payload = pack('>I',(int(time.time())+random.randrange(-300, 300)))#the current time plus or minus five minutes.
|
||||||
payload += encodeVarint(addressVersionNumber)
|
payload += encodeVarint(addressVersionNumber)
|
||||||
|
@ -4054,15 +4070,6 @@ if __name__ == "__main__":
|
||||||
shared.reloadMyAddressHashes()
|
shared.reloadMyAddressHashes()
|
||||||
shared.reloadBroadcastSendersForWhichImWatching()
|
shared.reloadBroadcastSendersForWhichImWatching()
|
||||||
|
|
||||||
#Initialize the ackdataForWhichImWatching data structure using data from the sql database.
|
|
||||||
shared.sqlSubmitQueue.put('''SELECT ackdata FROM sent where (status='msgsent' OR status='doingmsgpow')''')
|
|
||||||
shared.sqlSubmitQueue.put('')
|
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
|
||||||
for row in queryreturn:
|
|
||||||
ackdata, = row
|
|
||||||
print 'Watching for ackdata', ackdata.encode('hex')
|
|
||||||
ackdataForWhichImWatching[ackdata] = 0
|
|
||||||
|
|
||||||
if shared.safeConfigGetBoolean('bitmessagesettings','apienabled'):
|
if shared.safeConfigGetBoolean('bitmessagesettings','apienabled'):
|
||||||
try:
|
try:
|
||||||
apiNotifyPath = shared.config.get('bitmessagesettings','apinotifypath')
|
apiNotifyPath = shared.config.get('bitmessagesettings','apinotifypath')
|
||||||
|
|
|
@ -529,7 +529,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
|
|
||||||
# create application indicator
|
# create application indicator
|
||||||
def appIndicatorInit(self,app):
|
def appIndicatorInit(self,app):
|
||||||
self.tray = QSystemTrayIcon(QtGui.QIcon("images/can-icon-24px-red.png"), app)
|
self.tray = QSystemTrayIcon(QtGui.QIcon(":/newPrefix/images/can-icon-24px-red.png"), app)
|
||||||
if sys.platform[0:3] == 'win':
|
if sys.platform[0:3] == 'win':
|
||||||
traySignal = "activated(QSystemTrayIcon::ActivationReason)"
|
traySignal = "activated(QSystemTrayIcon::ActivationReason)"
|
||||||
QtCore.QObject.connect(self.tray, QtCore.SIGNAL(traySignal), self.__icon_activated)
|
QtCore.QObject.connect(self.tray, QtCore.SIGNAL(traySignal), self.__icon_activated)
|
||||||
|
@ -1979,7 +1979,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if len(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject()) < 30000:
|
if len(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject()) < 30000:
|
||||||
self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject())#Only show the first 30K characters
|
self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject())#Only show the first 30K characters
|
||||||
else:
|
else:
|
||||||
self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject()[:30000]+'\n\nDisplay of the remainder of the message truncated because it is too long.')#Only show the first 30K characters
|
self.ui.textEditInboxMessage.setPlainText(self.ui.tableWidgetInbox.item(currentRow,2).data(Qt.UserRole).toPyObject()[:30000]+'\n\nDisplay of the remainder of the message truncated because it is too long.')#Only show the first 30K characters
|
||||||
|
|
||||||
font = QFont()
|
font = QFont()
|
||||||
font.setBold(False)
|
font.setBold(False)
|
||||||
|
|
Reference in New Issue
Block a user