shared.connectedHostsList is obsolete

This commit is contained in:
Dmitri Bogomolov 2018-11-01 16:28:42 +02:00
parent ee7aa6c28d
commit 5b5ec2b63d
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
3 changed files with 10 additions and 8 deletions

View File

@ -31,6 +31,8 @@ from pyelliptic.openssl import OpenSSL
import queues
import shared
import shutdown
import network.stats
quit = False
menutab = 1
@ -209,12 +211,16 @@ def drawtab(stdscr):
stdscr.addstr(6+i, 120, str(item[2]), a)
elif menutab == 8: # Network status
# Connection data
stdscr.addstr(4, 5, "Total Connections: "+str(len(shared.connectedHostsList)).ljust(2))
connected_hosts = network.stats.connectedHostsList()
stdscr.addstr(
4, 5, "Total Connections: " +
str(len(connected_hosts)).ljust(2)
)
stdscr.addstr(6, 6, "Stream #", curses.A_BOLD)
stdscr.addstr(6, 18, "Connections", curses.A_BOLD)
stdscr.hline(7, 6, '-', 23)
streamcount = []
for host, stream in shared.connectedHostsList.items():
for host, stream in connected_hosts:
if stream >= len(streamcount):
streamcount.append(1)
else:
@ -776,7 +782,7 @@ def sendMessage(sender="", recv="", broadcast=None, subject="", body="", reply=F
set_background_title(d, "Recipient address error")
scrollbox(d, unicode("Bitmessage currently only supports stream numbers of 1, unlike as requested for address " + addr + "."))
continue
if len(shared.connectedHostsList) == 0:
if not network.stats.connectedHostsList():
set_background_title(d, "Not connected warning")
scrollbox(d, unicode("Because you are not currently connected to the network, "))
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel')

View File

@ -431,7 +431,6 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
if not self.peerValidityChecks():
# TODO ABORT
return True
#shared.connectedHostsList[self.destination] = self.streams[0]
self.append_write_buf(protocol.CreatePacket('verack'))
self.verackSent = True
if not self.isOutbound:

View File

@ -50,10 +50,7 @@ myAddressesByTag = {}
broadcastSendersForWhichImWatching = {}
printLock = threading.Lock()
statusIconColor = 'red'
# List of hosts to which we are connected. Used to guarantee
# that the outgoingSynSender threads won't connect to the same
# remote node twice.
connectedHostsList = {}
thisapp = None # singleton lock instance
alreadyAttemptedConnectionsList = {
} # This is a list of nodes to which we have already attempted a connection