if(int(time.time())-timeLastSeen)>172800:# for nodes older than 48 hours old, delete from the knownNodes data-structure.
iflen(knownNodes[self.streamNumber])>1000:#as long as we have more than 1000 hosts in our list
if(int(time.time())-timeLastSeen)>172800andlen(knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the knownNodes data-structure.
delknownNodes[self.streamNumber][HOST]
print'deleting ',HOST,'from knownNodes because it is more than 48 hours old and we could not connect to it.'
if(int(time.time())-timeLastSeen)>172800andlen(knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the knownNodes data-structure.
delknownNodes[self.streamNumber][HOST]
print'deleting ',HOST,'from knownNodes because it is more than 48 hours old and we could not connect to it.'
"""except Exception, err:
print'Could NOT connect to',HOST,'during outgoing attempt.',err
if(int(time.time())-timeLastSeen)>172800andlen(knownNodes[self.streamNumber])>1000:# for nodes older than 48 hours old if we have more than 1000 hosts in our list, delete from the knownNodes data-structure.
delknownNodes[self.streamNumber][HOST]
print'deleting ',HOST,'from knownNodes because it is more than 48 hours old and we could not connect to it.'"""
time.sleep(1)
#Only one singleListener thread will ever exist. It creates the receiveDataThread and sendDataThread for each incoming connection. Note that it cannot set the stream number because it is not known yet- the other node will have to tell us its stream number in a version message. If we don't care about their stream, we will close the connection (within the recversion function of the recieveData thread)
@ -114,6 +171,9 @@ class singleListener(QThread):
defrun(self):
#We don't want to accept incoming connections if the user is using a SOCKS proxy. If they eventually select proxy 'none' then this will start listening for connections.
self.incomingConnectionList=[]#This list isn't used for anything. The reason it exists is because receiveData threads expect that a list be passed to them. They expect this because the outgoingSynSender thread DOES use a similar list to keep track of the number of outgoing connections it has created.
whileTrue:
#for i in range(0,1): #uncomment this line and comment the line above this to accept only one connection.
rd=receiveDataThread()
#We don't want to accept incoming connections if the user is using a SOCKS proxy. If they eventually select proxy 'none' then this will start listening for connections.
#I think that the only way an exception could occur here is if we connect to ourselves because it would try to delete the same IP from connectedHostsList twice.
print'Could not delete',self.HOST,'from connectedHostsList.',err
defprocessData(self):
globalverbose
@ -831,7 +897,7 @@ class receiveDataThread(QThread):
timeSomeoneElseReceivedMessageFromThisNode,=unpack('>I',self.data[24+lengthOfNumberOfAddresses+(34*i):28+lengthOfNumberOfAddresses+(34*i)])#This is the 'time' value in the received addr message.
iflen(knownNodes[recaddrStream])<20000andtimeSomeoneElseReceivedMessageFromThisNode>(int(time.time())-10800)andtimeSomeoneElseReceivedMessageFromThisNode<(int(time.time())+10800):#If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now.
@ -1550,7 +1618,8 @@ class sqlThread(QThread):
self.cur.execute('''DELETE FROM pubkeys WHERE hash='1234'''')
self.conn.commit()
iftransmitdata=='':
sys.stderr.write('Problem: The version of SQLite you have cannot store Null values. Please download and install the latest revision of your version of Python (for example, the latest Python 2.7 revision) and try again. Exiting.\n')
sys.stderr.write('Problem: The version of SQLite you have cannot store Null values. Please download and install the latest revision of your version of Python (for example, the latest Python 2.7 revision) and try again.\n')
sys.stderr.write('PyBitmessage will now exist 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')
sys.exit()
exceptException,err:
printerr
@ -2015,6 +2084,7 @@ class addressGenerator(QThread):
config.add_section(address)
config.set(address,'label',self.label)
config.set(address,'enabled','true')
config.set(address,'decoy','false')
config.set(address,'n',str(privkey['n']))
config.set(address,'e',str(privkey['e']))
config.set(address,'d',str(privkey['d']))
@ -2110,14 +2180,56 @@ class settingsDialog(QtGui.QDialog):
self.ui.labelSettingsNote.setText('Options have been disabled because they either arn\'t applicable or because they haven\'t yet been implimented for your operating system.')
elif'linux'insys.platform:
pass
self.ui.checkBoxStartOnLogon.setDisabled(True)
self.ui.labelSettingsNote.setText('Options have been disabled because they either arn\'t applicable or because they haven\'t yet been implimented for your operating system.')
@ -2182,6 +2294,9 @@ class MyForm(QtGui.QMainWindow):
menu=QtGui.QMenu()
self.exitAction=menu.addAction("Exit",self.close)
self.trayIcon.setContextMenu(menu)
#I'm currently under the impression that Mac users have different expectations for the tray icon. They don't necessairly expect it to open the main window when clicked and they still expect a program showing a tray icon to also be in the dock.
reply=QtGui.QMessageBox.question(self,'Open keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)',QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
ifreply==QtGui.QMessageBox.Yes:
self.openKeysFile()
else:
pass
if'darwin'insys.platformor'linux'insys.platform:
reply=QtGui.QMessageBox.information(self,'keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file.',QMessageBox.Ok)
elifsys.platform=='win32'orsys.platform=='win64':
reply=QtGui.QMessageBox.question(self,'Open keys.dat?','You may manage your keys by editing the keys.dat file stored in\n'+appdata+'\nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)',QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
ifreply==QtGui.QMessageBox.Yes:
self.openKeysFile()
else:
pass
defopenKeysFile(self):
if'linux'insys.platform:
@ -2506,13 +2623,13 @@ class MyForm(QtGui.QMainWindow):
QMessageBox.about(self,"Restart","Bitmessage will use your proxy from now on now but you may want to manually restart Bitmessage now to close existing connections.")
self.label_2.setText(QtGui.QApplication.translate("iconGlossaryDialog","You have no connections with other peers. ",None,QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("iconGlossaryDialog","You have made at least one connection to a peer using an outgoing connection but you have not yet received any incoming connections. Your firewall or home router probably isn\'t configured to foward incoming TCP connections to your computer. Bitmessage will work just fine but it would help the Bitmessage network if you allowed for incoming connections and will help you be a better-connected node.",None,QtGui.QApplication.UnicodeUTF8))
self.label_6.setText(QtGui.QApplication.translate("iconGlossaryDialog","You do have connections with other peers and your firewall is correctly configured.",None,QtGui.QApplication.UnicodeUTF8))
self.labelPortNumber.setText(QtGui.QApplication.translate("iconGlossaryDialog","You are using TCP port ?. (This can be changed in the settings).",None,QtGui.QApplication.UnicodeUTF8))
self.label_6.setText(QtGui.QApplication.translate("iconGlossaryDialog","You do have connections with other peers and your firewall is correctly configured.",None,QtGui.QApplication.UnicodeUTF8))
<string>You have made at least one connection to a peer using an outgoing connection but you have not yet received any incoming connections. Your firewall or home router probably isn't configured to foward incoming TCP connections to your computer. Bitmessage will work just fine but it would help the Bitmessage network if you allowed for incoming connections and will help you be a better-connected node.</string>
<string>You have made at least one connection to a peer using an outgoing connection but you have not yet received any incoming connections. Your firewall or home router probably isn't configured to foward incoming TCP connections to your computer. Bitmessage will work just fine but it would help the Bitmessage network if you allowed for incoming connections and will help you be a better-connected node.</string>
@ -84,6 +146,17 @@ class Ui_settingsDialog(object):
self.checkBoxMinimizeToTray.setText(QtGui.QApplication.translate("settingsDialog","Minimize to tray",None,QtGui.QApplication.UnicodeUTF8))
self.checkBoxShowTrayNotifications.setText(QtGui.QApplication.translate("settingsDialog","Show notification when message received and minimzed to tray",None,QtGui.QApplication.UnicodeUTF8))