Peter Surda
9683c879bc
- Network status UI works but current speed isn't implemented yet - Track per connection and global transferred bytes - Add locking to write queue so that other threads can put stuff there - send ping on timeout (instead of closing the connection) - implement open port checker (untested, never triggered yet) - error handling on IO
17 lines
408 B
Python
17 lines
408 B
Python
from queues import Queue
|
|
import random
|
|
|
|
from bmconfigparser import BMConfigParser
|
|
import knownnodes
|
|
from queues import portCheckerQueue
|
|
import state
|
|
|
|
def chooseConnection(stream):
|
|
if state.trustedPeer:
|
|
return state.trustedPeer
|
|
else:
|
|
try:
|
|
return portCheckerQueue.get(False)
|
|
except Queue.Empty:
|
|
return random.choice(knownnodes.knownNodes[stream].keys())
|