예제 #1
0
      # Try to find our external IP.
      myip = emulcomm.getmyip()
    except Exception, e: # Replace with InternetConnectivityError ?
      # If we aren't connected to the internet, emulcomm.getmyip() raises this:
      if len(e.args) >= 1 and e.args[0] == "Cannot detect a connection to the Internet.":
        # So we try again.
        pass
      else:
        # It wasn't emulcomm.getmyip()'s exception. re-raise.
        raise
    else:
      # We succeeded in getting our external IP. Leave the loop.
      break
    time.sleep(0.1)

  vesseldict = nmrequesthandler.initialize(myip, configuration['publickey'], version)

  # Start accepter...
  myname = start_accepter()

  # Initialize the global node name inside node reset configuration dict
  node_reset_config['name'] = myname
  
  #send our advertised name to the log
  servicelogger.log('myname = '+str(myname))

  # Start worker thread...
  start_worker_thread(configuration['pollfrequency'])

  # Start advert thread...
  start_advert_thread(vesseldict, myname, configuration['publickey'])
예제 #2
0
            myip = emulcomm.getmyip()
        except Exception, e:  # Replace with InternetConnectivityError ?
            # If we aren't connected to the internet, emulcomm.getmyip() raises this:
            if len(e.args) >= 1 and e.args[
                    0] == "Cannot detect a connection to the Internet.":
                # So we try again.
                pass
            else:
                # It wasn't emulcomm.getmyip()'s exception. re-raise.
                raise
        else:
            # We succeeded in getting our external IP. Leave the loop.
            break
        time.sleep(0.1)

    vesseldict = nmrequesthandler.initialize(myip, configuration['publickey'],
                                             version)

    # Start accepter...
    myname = start_accepter()

    # Initialize the global node name inside node reset configuration dict
    node_reset_config['name'] = myname

    #send our advertised name to the log
    servicelogger.log('myname = ' + str(myname))

    # Start worker thread...
    start_worker_thread(configuration['pollfrequency'])

    # Start advert thread...
    start_advert_thread(vesseldict, myname, configuration['publickey'])