def on_unregister_file_receiving(transfer_id, status, bytes_received, error_message=''): """ Called from transport plug-in after finish receiving a single file. """ pkt_in = packet_in.get(transfer_id) if not pkt_in: lg.exc(exc_value=Exception( 'incoming packet with transfer_id=%r not exist' % transfer_id)) return False if _Debug: if status == 'finished': lg.out( _DebugLevel, '<<< IN <<< (%d) [%s://%s] %s with %d bytes' % (transfer_id, pkt_in.proto, pkt_in.host, status.upper(), bytes_received)) else: lg.out( _DebugLevel, '<<< IN <<< (%d) [%s://%s] %s : %s' % (transfer_id, pkt_in.proto, pkt_in.host, status.upper(), error_message)) pkt_in.automat('unregister-item', (status, bytes_received, error_message)) control.request_update([('stream', transfer_id)]) return True
def cancel_input_file(transferID, why=None): pkt_in = packet_in.get(transferID) assert pkt_in is not None if _Debug: lg.out(_DebugLevel - 4, 'gateway.cancel_input_file : %s why: %s' % (transferID, why)) pkt_in.automat('cancel', why) return True
def on_unregister_file_receiving(transfer_id, status, bytes_received, error_message=""): """ Called from transport plug-in after finish receiving a single file. """ pkt_in = packet_in.get(transfer_id) assert pkt_in is not None if status == "finished": if _Debug: lg.out( _DebugLevel, "<<< IN <<< (%d) [%s://%s] %s with %d bytes" % (transfer_id, pkt_in.proto, pkt_in.host, status.upper(), bytes_received), ) else: if _Debug: lg.out( _DebugLevel, "<<< IN <<< (%d) [%s://%s] %s : %s" % (transfer_id, pkt_in.proto, pkt_in.host, status.upper(), error_message), ) pkt_in.automat("unregister-item", (status, bytes_received, error_message)) control.request_update([("stream", transfer_id)]) return True
def on_unregister_file_receiving(transfer_id, status, bytes_received, error_message=''): """ Called from transport plug-in after finish receiving a single file. """ pkt_in = packet_in.get(transfer_id) assert pkt_in is not None if status == 'finished': if _Debug: lg.out( _DebugLevel, '<<< IN <<< (%d) [%s://%s] %s with %d bytes' % (transfer_id, pkt_in.proto, pkt_in.host, status.upper(), bytes_received)) else: if _Debug: lg.out( _DebugLevel, '<<< IN <<< (%d) [%s://%s] %s : %s' % (transfer_id, pkt_in.proto, pkt_in.host, status.upper(), error_message)) pkt_in.automat('unregister-item', (status, bytes_received, error_message)) control.request_update([('stream', transfer_id)]) return True
def cancel_input_file(transferID, why=None): pkt_in = packet_in.get(transferID) assert pkt_in is not None pkt_in.automat("cancel", why) return True