Пример #1
0
    def connectToNodes(nodes, openConnsList):
        if len(nodes) == 0:
            # If this is a bootstrap.
            global firstConnectTriggered
            if not firstConnectTriggered and (globals.newborn or globals.nuked
                                              or globals.resetted):
                firstConnectTriggered = True
                print('We\'re bootstrapping!')
                connectWithIP('151.236.11.192', 39994)  # austria #FIXME 39994
            else:
                print('There are no nodes to connect to!')
                print('Number of open connections:', len(openConnsList),
                      'Commit in Progress: ',
                      committerInstance.commitInProgress)
                if not len(openConnsList
                           ) and not committerInstance.commitInProgress:
                    connectWithIP('151.236.11.192',
                                  39994)  # austria #FIXME 39994

        for n in nodes:
            print('I\'m attempting to connect to node %s at %s:%s' %
                  (n.NodeId, n.LastConnectedIP if n.LastConnectedIP is not None
                   else n.LastRetrievedIP, n.LastConnectedPort if
                   n.LastConnectedPort is not None else n.LastRetrievedPort))
            connectWithNode(n.asDict())
Пример #2
0
 def connectToNodes(nodes, openConnsList):
     # if not committerInstance.commitInProgress: # Don't connect outbound if a commit is in progress.
     if len(nodes) == 0:
         print('There are no nodes to connect to!')
         lastBareIP = globals.userProfile.get('machineDetails', 'lastConnectedBareIP')
         lastBarePort = globals.userProfile.get('machineDetails', 'lastConnectedBarePort')
         if isinstance(lastBarePort, int) and isinstance(lastBareIP, basestring) and \
                         lastBarePort != 0 and not Demeter.committer.commitInProgress:
         # Only connect if there is a bare connection request before and there is no commit in progress.
         # This is to prevent the first connection repeatedly calling over and wasting bandwidth while he has
         # everything in memory, just committing.
             print('Reaching out to the last bare '
                   'connect attempt at %s : %s' % (lastBareIP, lastBarePort))
             connectWithIP(lastBareIP, lastBarePort)
         else:
             print('This computer has never bare-connected to another node or a commit is in progress. '
                   'This usually means onboarding is not completed. lastBarePort = %s, commitInProgress = %s' %
                   (lastBarePort, Demeter.committer.commitInProgress))
     print('Number of open connections:', len(openConnsList))
     for n in nodes:
          print('I\'m attempting to connect to node %s at %s:%s'
                %(n.NodeId,
                  n.LastConnectedIP if n.LastConnectedIP is not None else n.LastRetrievedIP,
                  n.LastConnectedPort if n.LastConnectedPort is not None else n.LastRetrievedPort))
          connectWithNode(n.asDict())
Пример #3
0
 def connectToNodes(nodes, openConnsList):
     # if not committerInstance.commitInProgress: # Don't connect outbound if a commit is in progress.
     if len(nodes) == 0:
         print('There are no nodes to connect to!')
         lastBareIP = globals.userProfile.get('machineDetails',
                                              'lastConnectedBareIP')
         lastBarePort = globals.userProfile.get('machineDetails',
                                                'lastConnectedBarePort')
         if isinstance(lastBarePort, int) and isinstance(lastBareIP, basestring) and \
                         lastBarePort != 0 and not Demeter.committer.commitInProgress:
             # Only connect if there is a bare connection request before and there is no commit in progress.
             # This is to prevent the first connection repeatedly calling over and wasting bandwidth while he has
             # everything in memory, just committing.
             print('Reaching out to the last bare '
                   'connect attempt at %s : %s' %
                   (lastBareIP, lastBarePort))
             connectWithIP(lastBareIP, lastBarePort)
         else:
             print(
                 'This computer has never bare-connected to another node or a commit is in progress. '
                 'This usually means onboarding is not completed. lastBarePort = %s, commitInProgress = %s'
                 % (lastBarePort, Demeter.committer.commitInProgress))
     print('Number of open connections:', len(openConnsList))
     for n in nodes:
         print('I\'m attempting to connect to node %s at %s:%s' %
               (n.NodeId, n.LastConnectedIP if n.LastConnectedIP is not None
                else n.LastRetrievedIP, n.LastConnectedPort if
                n.LastConnectedPort is not None else n.LastRetrievedPort))
         connectWithNode(n.asDict())
Пример #4
0
 def connectToNodes(nodes):
     if len(nodes) == 0 and (globals.newborn or globals.nuked):
     # If there is only the local node, that means no one to connect to.
         print('There are no nodes to connect to!')
         connectWithIP('151.236.11.192', 39994) # austria
     for n in nodes:
          print('I\'m attempting to connect to node %s at %s:%s'
                %(n.NodeId,
                  n.LastConnectedIP if n.LastConnectedIP is not None else n.LastRetrievedIP,
                  n.LastConnectedPort if n.LastConnectedPort is not None else n.LastRetrievedPort))
          connectWithNode(n.asDict())
Пример #5
0
    def connectToNodes(nodes, openConnsList):
        if len(nodes) == 0:
            # If this is a bootstrap.
            global firstConnectTriggered
            if not firstConnectTriggered and (globals.newborn or globals.nuked or globals.resetted):
                firstConnectTriggered = True
                print('We\'re bootstrapping!')
                connectWithIP('151.236.11.192', 39994) # austria #FIXME 39994
            else:
                print('There are no nodes to connect to!')
                print('Number of open connections:', len(openConnsList), 'Commit in Progress: ', committerInstance.commitInProgress)
                if not len(openConnsList) and not committerInstance.commitInProgress:
                    connectWithIP('151.236.11.192', 39994) # austria #FIXME 39994

        for n in nodes:
             print('I\'m attempting to connect to node %s at %s:%s'
                   %(n.NodeId,
                     n.LastConnectedIP if n.LastConnectedIP is not None else n.LastRetrievedIP,
                     n.LastConnectedPort if n.LastConnectedPort is not None else n.LastRetrievedPort))
             connectWithNode(n.asDict())