Пример #1
0
 def start_outbox_file(
         self,
         filename,
         filesize,
         description,
         result_defer,
         single):
     from transport.udp import udp_interface
     from transport.udp import udp_stream
     stream_id = self.make_unique_stream_id()
     if _Debug:
         lg.out(
             12,
             'udp_file_queue.start_outbox_file %d %s %s %d %s' %
             (stream_id,
              description,
              os.path.basename(filename),
              filesize,
              self.session.peer_id))
     self.outboxFiles[stream_id] = OutboxFile(
         self, stream_id, filename, filesize, description, result_defer, single)
     self.streams[stream_id] = udp_stream.create(
         stream_id, self.outboxFiles[stream_id], self)
     if not single:
         d = udp_interface.interface_register_file_sending(
             self.session.peer_id, self.session.peer_idurl, filename, description)
         d.addCallback(self.on_outbox_file_registered, stream_id)
         d.addErrback(self.on_outbox_file_register_failed, stream_id)
         self.outboxFiles[stream_id].registration = d
Пример #2
0
 def start_outbox_file(self, filename, filesize, description, result_defer, keep_alive):
     from transport.udp import udp_interface
     from transport.udp import udp_stream
     stream_id = self.make_unique_stream_id()
     if _Debug:
         lg.out(12, 'udp_file_queue.start_outbox_file %d %s %s %d %s' % (
             stream_id, description, os.path.basename(filename), filesize, self.session.peer_id))
     self.outboxFiles[stream_id] = OutboxFile(
         self, stream_id, filename, filesize, description, result_defer, keep_alive)
     self.streams[stream_id] = udp_stream.create(stream_id, self.outboxFiles[stream_id], self)
     if keep_alive:
         d = udp_interface.interface_register_file_sending(
             self.session.peer_id, self.session.peer_idurl, filename, description)
         d.addCallback(self.on_outbox_file_registered, stream_id)
         d.addErrback(self.on_outbox_file_register_failed, stream_id)
         self.outboxFiles[stream_id].registration = d