use import paths compatible with both Python2 and Python3
This commit is contained in:
parent
046a29e1a8
commit
f70aff617b
|
@ -23,38 +23,38 @@ import shared
|
|||
import state
|
||||
from debug import logger
|
||||
from tr import _translate
|
||||
from account import (
|
||||
from .account import (
|
||||
accountClass, getSortedSubscriptions,
|
||||
BMAccount, GatewayAccount, MailchuckAccount, AccountColor)
|
||||
from addresses import decodeAddress, addBMIfNotPresent
|
||||
from bitmessageui import Ui_MainWindow
|
||||
from bitmessageqt.bitmessageui import Ui_MainWindow
|
||||
from bmconfigparser import config
|
||||
import namecoin
|
||||
from messageview import MessageView
|
||||
from migrationwizard import Ui_MigrationWizard
|
||||
from foldertree import (
|
||||
from .messageview import MessageView
|
||||
from .migrationwizard import Ui_MigrationWizard
|
||||
from .foldertree import (
|
||||
AccountMixin, Ui_FolderWidget, Ui_AddressWidget, Ui_SubscriptionWidget,
|
||||
MessageList_AddressWidget, MessageList_SubjectWidget,
|
||||
Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress,
|
||||
MessageList_TimeWidget)
|
||||
import settingsmixin
|
||||
import support
|
||||
from bitmessageqt import settingsmixin
|
||||
from bitmessageqt import support
|
||||
from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure
|
||||
import helper_addressbook
|
||||
import helper_search
|
||||
import l10n
|
||||
from utils import str_broadcast_subscribers, avatarize
|
||||
import dialogs
|
||||
from .utils import str_broadcast_subscribers, avatarize
|
||||
from bitmessageqt import dialogs
|
||||
from network.stats import pendingDownload, pendingUpload
|
||||
from uisignaler import UISignaler
|
||||
from .uisignaler import UISignaler
|
||||
import paths
|
||||
from proofofwork import getPowType
|
||||
import queues
|
||||
import shutdown
|
||||
from statusbar import BMStatusBar
|
||||
import sound
|
||||
from .statusbar import BMStatusBar
|
||||
from bitmessageqt import sound
|
||||
# This is needed for tray icon
|
||||
import bitmessage_icons_rc # noqa:F401 pylint: disable=unused-import
|
||||
from bitmessageqt import bitmessage_icons_rc # noqa:F401 pylint: disable=unused-import
|
||||
import helper_sent
|
||||
|
||||
try:
|
||||
|
|
|
@ -9,9 +9,9 @@ from ver import ustr, unic
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
import queues
|
||||
import widgets
|
||||
from bitmessageqt import widgets
|
||||
import state
|
||||
from account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass
|
||||
from .account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass
|
||||
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
|
||||
from bmconfigparser import config as global_config
|
||||
from tr import _translate
|
||||
|
|
|
@ -12,7 +12,7 @@ from addresses import decodeAddress, addBMIfNotPresent
|
|||
from bmconfigparser import config
|
||||
from queues import apiAddressGeneratorReturnQueue, addressGeneratorQueue
|
||||
from tr import _translate
|
||||
from utils import str_chan
|
||||
from .utils import str_chan
|
||||
|
||||
|
||||
class AddressPassPhraseValidatorMixin(object):
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from bmconfigparser import config
|
||||
from foldertree import AddressBookCompleter
|
||||
from messageview import MessageView
|
||||
from messagecompose import MessageCompose
|
||||
import settingsmixin
|
||||
from networkstatus import NetworkStatus
|
||||
from blacklist import Blacklist
|
||||
from .foldertree import AddressBookCompleter
|
||||
from .messageview import MessageView
|
||||
from .messagecompose import MessageCompose
|
||||
from bitmessageqt import settingsmixin
|
||||
from .networkstatus import NetworkStatus
|
||||
from .blacklist import Blacklist
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
|
|
|
@ -4,13 +4,13 @@ from PyQt4 import QtCore, QtGui
|
|||
import widgets
|
||||
from addresses import addBMIfNotPresent
|
||||
from bmconfigparser import config
|
||||
from dialogs import AddAddressDialog
|
||||
from .dialogs import AddAddressDialog
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
from queues import UISignalQueue
|
||||
from retranslateui import RetranslateMixin
|
||||
from .retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
from uisignaler import UISignaler
|
||||
from utils import avatarize
|
||||
from .uisignaler import UISignaler
|
||||
from .utils import avatarize
|
||||
|
||||
|
||||
class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||
|
|
|
@ -6,14 +6,14 @@ from ver import ustr
|
|||
from PyQt4 import QtGui
|
||||
|
||||
import paths
|
||||
import widgets
|
||||
from address_dialogs import (
|
||||
from bitmessageqt import widgets
|
||||
from .address_dialogs import (
|
||||
AddAddressDialog, EmailGatewayDialog, NewAddressDialog,
|
||||
NewSubscriptionDialog, RegenerateAddressesDialog,
|
||||
SpecialAddressBehaviorDialog
|
||||
)
|
||||
from newchandialog import NewChanDialog
|
||||
from settings import SettingsDialog
|
||||
from .newchandialog import NewChanDialog
|
||||
from .settings import SettingsDialog
|
||||
from tr import _translate
|
||||
from version import softwareVersion
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
from bmconfigparser import config
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
from settingsmixin import SettingsMixin
|
||||
from .settingsmixin import SettingsMixin
|
||||
from tr import _translate
|
||||
from utils import avatarize
|
||||
from .utils import avatarize
|
||||
|
||||
# for pylupdate
|
||||
_translate("MainWindow", "inbox")
|
||||
|
|
|
@ -8,7 +8,7 @@ zoom and URL click warning popup
|
|||
from ver import ustr, unic
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from safehtmlparser import SafeHTMLParser
|
||||
from .safehtmlparser import SafeHTMLParser
|
||||
from tr import _translate
|
||||
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ from PyQt4 import QtCore, QtGui
|
|||
import l10n
|
||||
import network.stats
|
||||
import state
|
||||
import widgets
|
||||
from bitmessageqt import widgets
|
||||
from network import connectionpool, knownnodes
|
||||
from retranslateui import RetranslateMixin
|
||||
from .retranslateui import RetranslateMixin
|
||||
from tr import _translate
|
||||
from uisignaler import UISignaler
|
||||
from .uisignaler import UISignaler
|
||||
|
||||
|
||||
class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||
|
|
|
@ -7,13 +7,13 @@ src/bitmessageqt/newchandialog.py
|
|||
from ver import ustr, unic
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
import widgets
|
||||
from bitmessageqt import widgets
|
||||
from addresses import addBMIfNotPresent
|
||||
from addressvalidator import AddressValidator, PassPhraseValidator
|
||||
from .addressvalidator import AddressValidator, PassPhraseValidator
|
||||
from queues import (
|
||||
addressGeneratorQueue, apiAddressGeneratorReturnQueue, UISignalQueue)
|
||||
from tr import _translate
|
||||
from utils import str_chan
|
||||
from .utils import str_chan
|
||||
|
||||
|
||||
class NewChanDialog(QtGui.QDialog):
|
||||
|
|
|
@ -2,7 +2,7 @@ from os import path
|
|||
from ver import ustr
|
||||
from PyQt4 import QtGui
|
||||
from debug import logger
|
||||
import widgets
|
||||
from bitmessageqt import widgets
|
||||
|
||||
class RetranslateMixin(object):
|
||||
def retranslateUi(self):
|
||||
|
|
|
@ -17,7 +17,7 @@ import openclpow
|
|||
import paths
|
||||
import queues
|
||||
import state
|
||||
import widgets
|
||||
from bitmessageqt import widgets
|
||||
from bmconfigparser import config as config_obj
|
||||
from helper_sql import sqlExecute, sqlStoredProcedure
|
||||
from helper_startup import start_proxyconfig
|
||||
|
|
|
@ -9,7 +9,7 @@ import time
|
|||
from ver import ustr, unic
|
||||
from PyQt4 import QtCore
|
||||
|
||||
import account
|
||||
from bitmessageqt import account
|
||||
import defaults
|
||||
import network.stats
|
||||
import paths
|
||||
|
@ -17,12 +17,12 @@ import proofofwork
|
|||
import queues
|
||||
import state
|
||||
from bmconfigparser import config
|
||||
from foldertree import AccountMixin
|
||||
from .foldertree import AccountMixin
|
||||
from helper_sql import sqlExecute, sqlQuery
|
||||
from l10n import getTranslationLanguage
|
||||
from openclpow import openclEnabled
|
||||
from pyelliptic.openssl import OpenSSL
|
||||
from settings import getSOCKSProxyType
|
||||
from .settings import getSOCKSProxyType
|
||||
from version import softwareVersion
|
||||
from tr import _translate
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""bitmessageqt tests"""
|
||||
|
||||
from addressbook import TestAddressbook
|
||||
from main import TestMain, TestUISignaler
|
||||
from settings import TestSettings
|
||||
from support import TestSupport
|
||||
from .addressbook import TestAddressbook
|
||||
from .main import TestMain, TestUISignaler
|
||||
from .settings import TestSettings
|
||||
from .support import TestSupport
|
||||
|
||||
__all__ = [
|
||||
"TestAddressbook", "TestMain", "TestSettings", "TestSupport",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import helper_addressbook
|
||||
from bitmessageqt.support import createAddressIfNeeded
|
||||
|
||||
from main import TestBase
|
||||
from .main import TestBase
|
||||
|
||||
|
||||
class TestAddressbook(TestBase):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import threading
|
||||
import time
|
||||
|
||||
from main import TestBase
|
||||
from .main import TestBase
|
||||
from bmconfigparser import config
|
||||
from bitmessageqt import settings
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import sys
|
|||
|
||||
from shared import isAddressInMyAddressBook
|
||||
|
||||
from main import TestBase
|
||||
from .main import TestBase
|
||||
|
||||
from ver import ustr
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ def start(config, state):
|
|||
"""Start network threads"""
|
||||
import state
|
||||
from .announcethread import AnnounceThread
|
||||
import connectionpool # pylint: disable=relative-import
|
||||
from network import connectionpool
|
||||
from .addrthread import AddrThread
|
||||
from .dandelion import Dandelion
|
||||
from .downloadthread import DownloadThread
|
||||
|
|
|
@ -4,12 +4,12 @@ Announce addresses as they are received from other hosts
|
|||
from six.moves import queue
|
||||
|
||||
# magic imports!
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
from helper_random import randomshuffle
|
||||
from protocol import assembleAddrMessage
|
||||
from queues import addrQueue # FIXME: init with queue
|
||||
|
||||
from threads import StoppableThread
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
class AddrThread(StoppableThread):
|
||||
|
|
|
@ -7,7 +7,7 @@ import time
|
|||
|
||||
import network.asyncore_pollchoose as asyncore
|
||||
import state
|
||||
from threads import BusyError, nonBlocking
|
||||
from .threads import BusyError, nonBlocking
|
||||
|
||||
|
||||
class ProcessingError(Exception):
|
||||
|
|
|
@ -4,12 +4,12 @@ Announce myself (node address)
|
|||
import time
|
||||
|
||||
# magic imports!
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
from bmconfigparser import config
|
||||
from protocol import assembleAddrMessage
|
||||
|
||||
from node import Peer
|
||||
from threads import StoppableThread
|
||||
from .node import Peer
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
class AnnounceThread(StoppableThread):
|
||||
|
|
|
@ -6,7 +6,7 @@ import time
|
|||
|
||||
import protocol
|
||||
import state
|
||||
import connectionpool
|
||||
import network.connectionpool # use long name to address recursive import
|
||||
from highlevelcrypto import calculateInventoryHash
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -99,7 +99,7 @@ class BMObject(object): # pylint: disable=too-many-instance-attributes
|
|||
logger.warning(
|
||||
'The object has invalid stream: %s', self.streamNumber)
|
||||
raise BMObjectInvalidError()
|
||||
if self.streamNumber not in connectionpool.pool.streams:
|
||||
if self.streamNumber not in network.connectionpool.pool.streams:
|
||||
logger.debug(
|
||||
'The streamNumber %i isn\'t one we are interested in.',
|
||||
self.streamNumber)
|
||||
|
|
|
@ -12,10 +12,10 @@ import time
|
|||
|
||||
# magic imports!
|
||||
import addresses
|
||||
import knownnodes
|
||||
from network import knownnodes
|
||||
import protocol
|
||||
import state
|
||||
import connectionpool
|
||||
import network.connectionpool # use long name to address recursive import
|
||||
from bmconfigparser import config
|
||||
from queues import invQueue, objectProcessorQueue, portCheckerQueue
|
||||
from randomtrackingdict import RandomTrackingDict
|
||||
|
@ -27,8 +27,8 @@ from network.bmobject import (
|
|||
)
|
||||
from network.proxy import ProxyError
|
||||
|
||||
from node import Node, Peer
|
||||
from objectracker import ObjectTracker, missingObjects
|
||||
from .node import Node, Peer
|
||||
from .objectracker import ObjectTracker, missingObjects
|
||||
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -445,7 +445,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
for seenTime, stream, _, ip, port in self._decode_addr():
|
||||
ip = str(ip)
|
||||
if (
|
||||
stream not in connectionpool.pool.streams
|
||||
stream not in network.connectionpool.pool.streams
|
||||
# FIXME: should check against complete list
|
||||
or ip.startswith('bootstrap')
|
||||
):
|
||||
|
@ -540,7 +540,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
if not self.isOutbound:
|
||||
self.append_write_buf(protocol.assembleVersionMessage(
|
||||
self.destination.host, self.destination.port,
|
||||
connectionpool.pool.streams, True,
|
||||
network.connectionpool.pool.streams, True,
|
||||
nodeid=self.nodeid))
|
||||
logger.debug(
|
||||
'%(host)s:%(port)i sending version',
|
||||
|
@ -596,7 +596,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
'Closed connection to %s because there is no overlapping'
|
||||
' interest in streams.', self.destination)
|
||||
return False
|
||||
if connectionpool.pool.inboundConnections.get(
|
||||
if network.connectionpool.pool.inboundConnections.get(
|
||||
self.destination):
|
||||
try:
|
||||
if not protocol.checkSocksIP(self.destination.host):
|
||||
|
@ -614,8 +614,8 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
# or server full report the same error to counter deanonymisation
|
||||
if (
|
||||
Peer(self.destination.host, self.peerNode.port)
|
||||
in connectionpool.pool.inboundConnections
|
||||
or len(connectionpool.pool)
|
||||
in network.connectionpool.pool.inboundConnections
|
||||
or len(network.connectionpool.pool)
|
||||
> config.safeGetInt(
|
||||
'bitmessagesettings', 'maxtotalconnections')
|
||||
+ config.safeGetInt(
|
||||
|
@ -627,7 +627,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
'Closed connection to %s due to server full'
|
||||
' or duplicate inbound/outbound.', self.destination)
|
||||
return False
|
||||
if connectionpool.pool.isAlreadyConnected(self.nonce):
|
||||
if network.connectionpool.pool.isAlreadyConnected(self.nonce):
|
||||
self.append_write_buf(protocol.assembleErrorMessage(
|
||||
errorText="I'm connected to myself. Closing connection.",
|
||||
fatal=2))
|
||||
|
@ -641,7 +641,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
@staticmethod
|
||||
def stopDownloadingObject(hashId, forwardAnyway=False):
|
||||
"""Stop downloading object *hashId*"""
|
||||
for connection in connectionpool.pool.connections():
|
||||
for connection in network.connectionpool.pool.connections():
|
||||
try:
|
||||
del connection.objectsNewToMe[hashId]
|
||||
except KeyError:
|
||||
|
|
|
@ -5,7 +5,7 @@ Select which node to connect to
|
|||
import logging
|
||||
import random
|
||||
|
||||
import knownnodes
|
||||
from network import knownnodes
|
||||
import protocol
|
||||
import state
|
||||
from bmconfigparser import config
|
||||
|
|
|
@ -8,19 +8,19 @@ import socket
|
|||
import sys
|
||||
import time
|
||||
|
||||
import asyncore_pollchoose as asyncore
|
||||
from network import asyncore_pollchoose as asyncore
|
||||
import helper_random
|
||||
import knownnodes
|
||||
from network import knownnodes
|
||||
import protocol
|
||||
import state
|
||||
from bmconfigparser import config
|
||||
from connectionchooser import chooseConnection
|
||||
from node import Peer
|
||||
from proxy import Proxy
|
||||
from tcp import (
|
||||
from .connectionchooser import chooseConnection
|
||||
from .node import Peer
|
||||
from .proxy import Proxy
|
||||
from .tcp import (
|
||||
bootstrap, Socks4aBMConnection, Socks5BMConnection,
|
||||
TCPConnection, TCPServer)
|
||||
from udp import UDPSocket
|
||||
from .udp import UDPSocket
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from random import choice, expovariate, sample
|
|||
from threading import RLock
|
||||
from time import time
|
||||
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
import state
|
||||
from queues import invQueue
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import state
|
|||
import addresses
|
||||
import helper_random
|
||||
import protocol
|
||||
import connectionpool
|
||||
from objectracker import missingObjects
|
||||
from threads import StoppableThread
|
||||
from network import connectionpool
|
||||
from .objectracker import missingObjects
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
class DownloadThread(StoppableThread):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import socket
|
||||
|
||||
from advanceddispatcher import AdvancedDispatcher
|
||||
import asyncore_pollchoose as asyncore
|
||||
from proxy import ProxyError
|
||||
from socks5 import Socks5Connection, Socks5Resolver
|
||||
from socks4a import Socks4aConnection, Socks4aResolver
|
||||
from .advanceddispatcher import AdvancedDispatcher
|
||||
from network import asyncore_pollchoose as asyncore
|
||||
from .proxy import ProxyError
|
||||
from .socks5 import Socks5Connection, Socks5Resolver
|
||||
from .socks4a import Socks4aConnection, Socks4aResolver
|
||||
|
||||
|
||||
class HttpError(ProxyError):
|
||||
|
|
|
@ -8,9 +8,9 @@ from time import time
|
|||
import addresses
|
||||
import protocol
|
||||
import state
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
from queues import invQueue
|
||||
from threads import StoppableThread
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
def handleExpiredDandelion(expired):
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
A thread to handle network concerns
|
||||
"""
|
||||
import network.asyncore_pollchoose as asyncore
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
from queues import excQueue
|
||||
from threads import StoppableThread
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
class BMNetworkThread(StoppableThread):
|
||||
|
|
|
@ -5,7 +5,7 @@ import time
|
|||
from threading import RLock
|
||||
|
||||
import state
|
||||
import connectionpool
|
||||
import network.connectionpool # use long name to address recursive import
|
||||
from randomtrackingdict import RandomTrackingDict
|
||||
|
||||
haveBloom = False
|
||||
|
@ -100,7 +100,7 @@ class ObjectTracker(object):
|
|||
|
||||
def handleReceivedObject(self, streamNumber, hashid):
|
||||
"""Handling received object"""
|
||||
for i in connectionpool.pool.connections():
|
||||
for i in network.connectionpool.pool.connections():
|
||||
if not i.fullyEstablished:
|
||||
continue
|
||||
try:
|
||||
|
|
|
@ -6,10 +6,10 @@ import logging
|
|||
import socket
|
||||
import time
|
||||
|
||||
import asyncore_pollchoose as asyncore
|
||||
from advanceddispatcher import AdvancedDispatcher
|
||||
from network import asyncore_pollchoose as asyncore
|
||||
from .advanceddispatcher import AdvancedDispatcher
|
||||
from bmconfigparser import config
|
||||
from node import Peer
|
||||
from .node import Peer
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import errno
|
|||
import Queue
|
||||
import socket
|
||||
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
from network.advanceddispatcher import UnknownStateError
|
||||
from queues import receiveDataQueue
|
||||
from threads import StoppableThread
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
class ReceiveQueueThread(StoppableThread):
|
||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
|||
import socket
|
||||
import struct
|
||||
|
||||
from proxy import GeneralProxyError, Proxy, ProxyError
|
||||
from .proxy import GeneralProxyError, Proxy, ProxyError
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import logging
|
|||
import socket
|
||||
import struct
|
||||
|
||||
from node import Peer
|
||||
from proxy import GeneralProxyError, Proxy, ProxyError
|
||||
from .node import Peer
|
||||
from .proxy import GeneralProxyError, Proxy, ProxyError
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ Network statistics
|
|||
"""
|
||||
import time
|
||||
|
||||
import asyncore_pollchoose as asyncore
|
||||
import connectionpool
|
||||
from objectracker import missingObjects
|
||||
from network import asyncore_pollchoose as asyncore
|
||||
from network import connectionpool
|
||||
from .objectracker import missingObjects
|
||||
|
||||
|
||||
lastReceivedTimestamp = time.time()
|
||||
|
|
|
@ -15,21 +15,21 @@ import helper_random
|
|||
import l10n
|
||||
import protocol
|
||||
import state
|
||||
import connectionpool
|
||||
import network.connectionpool # use long name to address recursive import
|
||||
from bmconfigparser import config
|
||||
from highlevelcrypto import randomBytes
|
||||
from queues import invQueue, receiveDataQueue, UISignalQueue
|
||||
from tr import _translate
|
||||
|
||||
import asyncore_pollchoose as asyncore
|
||||
import knownnodes
|
||||
from network import asyncore_pollchoose as asyncore
|
||||
from network import knownnodes
|
||||
from network.advanceddispatcher import AdvancedDispatcher
|
||||
from network.bmproto import BMProto
|
||||
from network.objectracker import ObjectTracker
|
||||
from network.socks4a import Socks4aConnection
|
||||
from network.socks5 import Socks5Connection
|
||||
from network.tls import TLSDispatcher
|
||||
from node import Peer
|
||||
from .node import Peer
|
||||
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -267,7 +267,7 @@ class TCPConnection(BMProto, TLSDispatcher):
|
|||
self.append_write_buf(
|
||||
protocol.assembleVersionMessage(
|
||||
self.destination.host, self.destination.port,
|
||||
connectionpool.pool.streams,
|
||||
network.connectionpool.pool.streams,
|
||||
False, nodeid=self.nodeid))
|
||||
self.connectedAt = time.time()
|
||||
receiveDataQueue.put(self.destination)
|
||||
|
@ -318,7 +318,7 @@ class Socks5BMConnection(Socks5Connection, TCPConnection):
|
|||
self.append_write_buf(
|
||||
protocol.assembleVersionMessage(
|
||||
self.destination.host, self.destination.port,
|
||||
connectionpool.pool.streams,
|
||||
network.connectionpool.pool.streams,
|
||||
False, nodeid=self.nodeid))
|
||||
self.set_state("bm_header", expectBytes=protocol.Header.size)
|
||||
return True
|
||||
|
@ -342,7 +342,7 @@ class Socks4aBMConnection(Socks4aConnection, TCPConnection):
|
|||
self.append_write_buf(
|
||||
protocol.assembleVersionMessage(
|
||||
self.destination.host, self.destination.port,
|
||||
connectionpool.pool.streams,
|
||||
network.connectionpool.pool.streams,
|
||||
False, nodeid=self.nodeid))
|
||||
self.set_state("bm_header", expectBytes=protocol.Header.size)
|
||||
return True
|
||||
|
@ -430,7 +430,7 @@ class TCPServer(AdvancedDispatcher):
|
|||
|
||||
state.ownAddresses[Peer(*sock.getsockname())] = True
|
||||
if (
|
||||
len(connectionpool.pool)
|
||||
len(network.connectionpool.pool)
|
||||
> config.safeGetInt(
|
||||
'bitmessagesettings', 'maxtotalconnections')
|
||||
+ config.safeGetInt(
|
||||
|
@ -442,7 +442,7 @@ class TCPServer(AdvancedDispatcher):
|
|||
sock.close()
|
||||
return
|
||||
try:
|
||||
connectionpool.pool.addConnection(
|
||||
network.connectionpool.pool.addConnection(
|
||||
TCPConnection(sock=sock))
|
||||
except socket.error:
|
||||
pass
|
||||
|
|
|
@ -8,12 +8,12 @@ import time
|
|||
# magic imports!
|
||||
import protocol
|
||||
import state
|
||||
import connectionpool
|
||||
import network.connectionpool # use long name to address recursive import
|
||||
from queues import receiveDataQueue
|
||||
|
||||
from bmproto import BMProto
|
||||
from node import Peer
|
||||
from objectracker import ObjectTracker
|
||||
from .bmproto import BMProto
|
||||
from .node import Peer
|
||||
from .objectracker import ObjectTracker
|
||||
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -82,7 +82,7 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
|||
remoteport = False
|
||||
for seenTime, stream, _, ip, port in addresses:
|
||||
decodedIP = protocol.checkIPAddress(str(ip))
|
||||
if stream not in connectionpool.pool.streams:
|
||||
if stream not in network.connectionpool.pool.streams:
|
||||
continue
|
||||
if (seenTime < time.time() - protocol.MAX_TIME_OFFSET
|
||||
or seenTime > time.time() + protocol.MAX_TIME_OFFSET):
|
||||
|
|
|
@ -6,9 +6,9 @@ import time
|
|||
import helper_random
|
||||
import protocol
|
||||
import state
|
||||
import connectionpool
|
||||
from network import connectionpool
|
||||
from randomtrackingdict import RandomTrackingDict
|
||||
from threads import StoppableThread
|
||||
from .threads import StoppableThread
|
||||
|
||||
|
||||
class UploadThread(StoppableThread):
|
||||
|
|
Reference in New Issue
Block a user