Пример #1
0
def reset_vessel_timeout():

  # resets each vessel's timeout to the original values before file upload
  for longname in seash_global_variables.vesselinfo:
    thisvesselhandle = seash_global_variables.vesselinfo[longname]['handle']
    thisvesselhandledict = fastnmclient.nmclient_get_handle_info(thisvesselhandle)
    thisvesselhandledict['timeout'] = seash_global_variables.globalseashtimeout
    fastnmclient.nmclient_set_handle_info(thisvesselhandle,thisvesselhandledict)
Пример #2
0
def reset_vessel_timeout():

    # resets each vessel's timeout to the original values before file upload
    for longname in seash_global_variables.vesselinfo:
        thisvesselhandle = seash_global_variables.vesselinfo[longname][
            'handle']
        thisvesselhandledict = fastnmclient.nmclient_get_handle_info(
            thisvesselhandle)
        thisvesselhandledict[
            'timeout'] = seash_global_variables.globalseashtimeout
        fastnmclient.nmclient_set_handle_info(thisvesselhandle,
                                              thisvesselhandledict)
Пример #3
0
def set_upload_timeout(filedata):

  filesize = len(filedata)
  est_upload_time = filesize / seash_global_variables.globaluploadrate

  # sets the new timeout if necessary
  if est_upload_time > seash_global_variables.globalseashtimeout:

    for longname in seash_global_variables.vesselinfo:
      thisvesselhandle = seash_global_variables.vesselinfo[longname]['handle']
      thisvesselhandledict = fastnmclient.nmclient_get_handle_info(thisvesselhandle)
      thisvesselhandledict['timeout'] = est_upload_time
      fastnmclient.nmclient_set_handle_info(thisvesselhandle,thisvesselhandledict)
Пример #4
0
def set_upload_timeout(filedata):

    filesize = len(filedata)
    est_upload_time = filesize / seash_global_variables.globaluploadrate

    # sets the new timeout if necessary
    if est_upload_time > seash_global_variables.globalseashtimeout:

        for longname in seash_global_variables.vesselinfo:
            thisvesselhandle = seash_global_variables.vesselinfo[longname][
                'handle']
            thisvesselhandledict = fastnmclient.nmclient_get_handle_info(
                thisvesselhandle)
            thisvesselhandledict['timeout'] = est_upload_time
            fastnmclient.nmclient_set_handle_info(thisvesselhandle,
                                                  thisvesselhandledict)
Пример #5
0
    # actions on...
    ownervessels, uservessels = fastnmclient.nmclient_listaccessiblevessels(nodehandle,seash_global_variables.keys[currentkeyname]['publickey'])

    retlist = []

    # we should add anything we can access (whether a user or owner vessel)
    for vesselname in ownervessels + uservessels:
      longname = host+":"+str(port)+":"+vesselname

      # if we haven't discovered the vessel previously...
      if longname not in seash_global_variables.targets:
        # set the vesselname in the handle
        newhandle = fastnmclient.nmclient_duplicatehandle(nodehandle)
        handleinfo = fastnmclient.nmclient_get_handle_info(newhandle)
        handleinfo['vesselname'] = vesselname
        fastnmclient.nmclient_set_handle_info(newhandle, handleinfo)

        # then add the vessel to the target list, etc.
        # add_vessel has no race conditions as long as longname is unique
        # (and it should be unique)
        id = add_vessel(longname,currentkeyname,newhandle)
        seash_global_variables.targets[targetgroup].append(longname)

        # and append some information to be printed...
        retlist.append('%'+str(id)+"("+longname+")")



  finally:
    fastnmclient.nmclient_destroyhandle(nodehandle)
Пример #6
0
            nodehandle,
            seash_global_variables.keys[currentkeyname]['publickey'])

        retlist = []

        # we should add anything we can access (whether a user or owner vessel)
        for vesselname in ownervessels + uservessels:
            longname = host + ":" + str(port) + ":" + vesselname

            # if we haven't discovered the vessel previously...
            if longname not in seash_global_variables.targets:
                # set the vesselname in the handle
                newhandle = fastnmclient.nmclient_duplicatehandle(nodehandle)
                handleinfo = fastnmclient.nmclient_get_handle_info(newhandle)
                handleinfo['vesselname'] = vesselname
                fastnmclient.nmclient_set_handle_info(newhandle, handleinfo)

                # then add the vessel to the target list, etc.
                # add_vessel has no race conditions as long as longname is unique
                # (and it should be unique)
                id = add_vessel(longname, currentkeyname, newhandle)
                seash_global_variables.targets[targetgroup].append(longname)

                # and append some information to be printed...
                retlist.append('%' + str(id) + "(" + longname + ")")

    finally:
        fastnmclient.nmclient_destroyhandle(nodehandle)

    return (True, retlist)
import fastnmclient

if __name__ == '__main__':

  pubkey = {'e': 1515278400394037168869631887206225761783197636247636149274740854708478416229147500580877416652289990968676310353790883501744269103521055894342395180721167L, 'n': 8811850224687278929671477591179591903829730117649785862652866020803862826558480006479605958786097112503418194852731900367494958963787480076175614578652735061071079458992502737148356289391380249696938882025028801032667062564713111819847043202173425187133883586347323838509679062142786013585264788548556099117804213139295498187634341184917970175566549405203725955179602584979965820196023950630399933075080549044334508921319264315718790337460536601263126663173385674250739895046814277313031265034275415434440823182691254039184953842629364697394327806074576199279943114384828602178957150547925812518281418481896604655037L}
  time_updatetime(34612)
  nmhandle = fastnmclient.nmclient_createhandle(getmyip(), <nodemanager_port>)
  
  myhandleinfo = fastnmclient.nmclient_get_handle_info(nmhandle)

  myhandleinfo['publickey'] = pubkey

  myhandleinfo['privatekey'] = {'q': 54058458609373005761636236344701348569916976061233632302656354317296914836524068463339023907975088241991695932495814481647444694298985642399081803007236201209469946258941304883759055364999601996691930482382846773100579600645226048615117420700557109784424679718473031043919444221865548436936151591443700338637L, 'p': 163005946735584933080904947630005844643976533101833337498275325109161034533761907731163804211972028706576149578068245770343911608552263828770803393409524864116386113730846986186991705365903821748069417335817777744060812709585990055899981036005918570773920278122250955465866247822703170432353212868019982497201L, 'd': 2240169959722743128383109799584344927620631289695753164608137553948562513840905705755472646965204244185778446323692147882435315849145863268402636875283224769523136754021661455550898853194946272632624967823932300133454648259819576163836968537588009990175504497443778516954738281566994011669204200464480373455393955376955298830900816876217755539224711550233098080437180969137329334691279693903616444969433587901167778818088572448203744563568733073397445832643374417179790887207750843422586891294093361764515116975052446191135748633217162309228939861802346846701415099277659436864814394138247474263285983065177006045103L}

  fastnmclient.nmclient_set_handle_info(nmhandle, myhandleinfo)

  # get the vessel to use...
  myvessel = fastnmclient.nmclient_listaccessiblevessels(nmhandle,pubkey)[0][0]

  fastnmclient.nmclient_signedsay(nmhandle, "AddFileToVessel", myvessel, "hello","hellodata")
  fastnmclient.nmclient_signedsay(nmhandle, "AddFileToVessel", myvessel, "helloworld.repy","print 'hello world'\nwhile True: sleep(.1)")
  fastnmclient.nmclient_signedsay(nmhandle, "AddFileToVessel", myvessel, "hello2","hellodata")

  fastnmclient.nmclient_signedsay(nmhandle, "StartVessel", myvessel, "helloworld.repy")
  

  # okay, now let's reset!
  fastnmclient.nmclient_signedsay(nmhandle, "ResetVessel", myvessel)

  
Пример #8
0
import fastnmclient

if __name__ == '__main__':

  pubkey = {'e': 1515278400394037168869631887206225761783197636247636149274740854708478416229147500580877416652289990968676310353790883501744269103521055894342395180721167L, 'n': 8811850224687278929671477591179591903829730117649785862652866020803862826558480006479605958786097112503418194852731900367494958963787480076175614578652735061071079458992502737148356289391380249696938882025028801032667062564713111819847043202173425187133883586347323838509679062142786013585264788548556099117804213139295498187634341184917970175566549405203725955179602584979965820196023950630399933075080549044334508921319264315718790337460536601263126663173385674250739895046814277313031265034275415434440823182691254039184953842629364697394327806074576199279943114384828602178957150547925812518281418481896604655037L}
  time_updatetime(34612)
  nmhandle = fastnmclient.nmclient_createhandle(getmyip(), <nodemanager_port>)
  
  myhandleinfo = fastnmclient.nmclient_get_handle_info(nmhandle)

  myhandleinfo['publickey'] = pubkey

  myhandleinfo['privatekey'] = {'q': 54058458609373005761636236344701348569916976061233632302656354317296914836524068463339023907975088241991695932495814481647444694298985642399081803007236201209469946258941304883759055364999601996691930482382846773100579600645226048615117420700557109784424679718473031043919444221865548436936151591443700338637L, 'p': 163005946735584933080904947630005844643976533101833337498275325109161034533761907731163804211972028706576149578068245770343911608552263828770803393409524864116386113730846986186991705365903821748069417335817777744060812709585990055899981036005918570773920278122250955465866247822703170432353212868019982497201L, 'd': 2240169959722743128383109799584344927620631289695753164608137553948562513840905705755472646965204244185778446323692147882435315849145863268402636875283224769523136754021661455550898853194946272632624967823932300133454648259819576163836968537588009990175504497443778516954738281566994011669204200464480373455393955376955298830900816876217755539224711550233098080437180969137329334691279693903616444969433587901167778818088572448203744563568733073397445832643374417179790887207750843422586891294093361764515116975052446191135748633217162309228939861802346846701415099277659436864814394138247474263285983065177006045103L}

  fastnmclient.nmclient_set_handle_info(nmhandle, myhandleinfo)

  # get the vessel to use...
  myvessel = fastnmclient.nmclient_listaccessiblevessels(nmhandle,pubkey)[0][0]

  fastnmclient.nmclient_signedsay(nmhandle, "AddFileToVessel", myvessel, "hello","hellodata")
  fastnmclient.nmclient_signedsay(nmhandle, "AddFileToVessel", myvessel, "helloworld.r2py","log('hello world')\nwhile True: sleep(.1)")
  fastnmclient.nmclient_signedsay(nmhandle, "AddFileToVessel", myvessel, "hello2","hellodata")

  fastnmclient.nmclient_signedsay(nmhandle, "StartVesselEx", myvessel, "repyV2", "helloworld.r2py")
  

  # okay, now let's reset!
  fastnmclient.nmclient_signedsay(nmhandle, "ResetVessel", myvessel)