- Missing renamed to PendingDownload
- PendingDownload now only retries 3 times rather than 6 to dowload an
object
- Added PendingUpload, replacing invQueueSize
- PendingUpload has both the "len" method (number of objects not
uploaded) as well as "progress" method, which is a float from 0
(nothing done) to 1 (all uploaded) which considers not only objects
but also how many nodes they are uploaded to
- PendingUpload tracks when the object is successfully uploaded to the
remote node instead of just adding an arbitrary time after they have
been send the corresponding "inv"
- Network status tab's "Objects to be synced" shows the sum of
PendingUpload and PendingDownload sizes
_translate("MainWindow","Bitmessage hasn't synchronised with the network, %n object(s) to be downloaded. If you quit now, it may cause delivery delays. Wait until the synchronisation finishes?",None,QtCore.QCoreApplication.CodecForTr,Missing().len()),
_translate("MainWindow","Bitmessage hasn't synchronised with the network, %n object(s) to be downloaded. If you quit now, it may cause delivery delays. Wait until the synchronisation finishes?",None,QtCore.QCoreApplication.CodecForTr,PendingDownload().len()),
# check if upload (of objects created locally) pending
self.statusBar().showMessage(_translate("MainWindow","Waiting for objects to be sent... %1%").arg(str(50)))
maxWaitingObjects=0
curWaitingObjects=invQueueSize()
whilecurWaitingObjects>0:
curWaitingObjects=invQueueSize()
ifcurWaitingObjects>maxWaitingObjects:
maxWaitingObjects=curWaitingObjects
ifcurWaitingObjects>0:
self.statusBar().showMessage(_translate("MainWindow","Waiting for objects to be sent... %1%").arg(str(50+20*(maxWaitingObjects-curWaitingObjects)/maxWaitingObjects)))
try:
whilePendingUpload().progress()<1:
self.statusBar().showMessage(_translate("MainWindow","Waiting for objects to be sent... %1%").arg(str(int(50+20*PendingUpload().progress()))))
@ -45,7 +45,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
return"%4.0f kB"%num
defupdateNumberOfObjectsToBeSynced(self):
self.labelSyncStatus.setText(_translate("networkstatus","Object(s) to be synced: %n",None,QtCore.QCoreApplication.CodecForTr,Missing().len()))
self.labelSyncStatus.setText(_translate("networkstatus","Object(s) to be synced: %n",None,QtCore.QCoreApplication.CodecForTr,PendingDownload().len()+PendingUpload().len()))
logger.info('inv message lists %s objects. Of those %s are new to me. It took %s seconds to figure that out.',numberOfItemsInInv,len(objectsNewToMe),time.time()-startTime)
foriteminobjectsNewToMe:
Missing().add(item)
PendingDownload().add(item)
self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware[item]=0# helps us keep from sending inv messages to peers that already know about the objects listed therein
# Send a getdata message to our peer to request the object with the given
@ -439,15 +442,15 @@ class receiveDataThread(threading.Thread):
self.antiIntersectionDelay()
else:
ifhashinInventory():
self.sendObject(Inventory()[hash].payload)
self.sendObject(hash,Inventory()[hash].payload)
else:
self.antiIntersectionDelay()
logger.warning('%s asked for an object with a getdata which is not in either our memory inventory or our SQL inventory. We probably cleaned it out after advertising it but before they got around to asking for it.'%(self.peer,))
# Our peer has requested (in a getdata message) that we send an object.
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr._translate("MainWindow","Message sent. Sent at %1").arg(l10n.formatTimestamp()))))
else:
@ -922,6 +927,7 @@ class singleWorker(threading.Thread, StoppableThread):
objectType=1
Inventory()[inventoryHash]=(
objectType,streamNumber,payload,embeddedTime,'')
PendingUpload().add(inventoryHash)
logger.info('sending inv (for the getpubkey message)')