def on_register_file_receiving(proto, host, sender_idurl, filename, size=0): """ Called from transport plug-in when receiving a single file were started from some peer. Must return a unique transfer ID, create a `FileTransferInfo` object and put it into "transfers" list. Plug-in's code must create a temporary file and write incoming data into that file. """ transfer_id = make_transfer_ID() if _Debug: lg.out( _DebugLevel, "... IN ... %d receive {%s} via [%s] from %s at %s" % (transfer_id, os.path.basename(filename), proto, nameurl.GetName(sender_idurl), host), ) packet_in.create(transfer_id).automat("register-item", (proto, host, sender_idurl, filename, size)) control.request_update([("stream", transfer_id)]) return transfer_id
def on_register_file_receiving(proto, host, sender_idurl, filename, size=0): """ Called from transport plug-in when receiving a single file were started from some peer. Must return a unique transfer ID, create a `FileTransferInfo` object and put it into "transfers" list. Plug-in's code must create a temporary file and write incoming data into that file. """ transfer_id = make_transfer_ID() if _Debug: lg.out( _DebugLevel, '... IN ... %d receive {%s} via [%s] from %s at %s' % (transfer_id, os.path.basename(filename), proto, nameurl.GetName(sender_idurl), host)) packet_in.create(transfer_id).automat( 'register-item', (proto, host, sender_idurl, filename, size)) control.request_update([('stream', transfer_id)]) return transfer_id