'''The singleCleaner class is a timer-driven thread that cleans data structures to free memory, resends messages when a remote node doesn't respond, and sends pong messages to keep connections alive if the network isn't busy.
0,'pong','no data'))# commands the sendData threads to send out a pong message if they haven't sent anything else in the last five minutes. The socket timeout-time is 10 minutes.
'''select toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber FROM sent WHERE ((status='awaitingpubkey' OR status='msgsent') AND folder='sent') ''')# If the message's folder='trash' then we'll ignore it.
# Let us write out the knowNodes to disk if there is anything new to write out.
ifshared.needToWriteKnownNodesToDisk:
shared.knownNodesLock.acquire()
output=open(shared.appdata+'knownnodes.dat','wb')
try:
pickle.dump(shared.knownNodes,output)
output.close()
exceptExceptionaserr:
if"Errno 28"instr(err):
logger.fatal('(while receiveDataThread shared.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)))
print'It has been a long time and we haven\'t heard a response to our getpubkey request. Sending again.'
try:
delshared.neededPubkeys[
toripe]# We need to take this entry out of the shared.neededPubkeys structure because the shared.workerQueue checks to see whether the entry is already present and will not do the POW and send the message because it assumes that it has already done it recently.
except:
pass
shared.UISignalQueue.put((
'updateStatusBar','Doing work necessary to again attempt to request a public key...'))
t=()
sqlExecute(
'''UPDATE sent SET lastactiontime=?, pubkeyretrynumber=?, status='msgqueued' WHERE toripe=?''',
int(time.time()),
pubkeyretrynumber+1,
toripe)
shared.workerQueue.put(('sendmessage',''))
defresendMsg(msgretrynumber,ackdata):
print'It has been a long time and we haven\'t heard an acknowledgement to our msg. Sending again.'
sqlExecute(
'''UPDATE sent SET lastactiontime=?, msgretrynumber=?, status=? WHERE ackdata=?''',
int(time.time()),
msgretrynumber+1,
'msgqueued',
ackdata)
shared.workerQueue.put(('sendmessage',''))
shared.UISignalQueue.put((
'updateStatusBar','Doing work necessary to again attempt to deliver a message...'))