コード例 #1
0
ファイル: udp_interface.py プロジェクト: hack-bitdust/devel
 def list_streams(self, sorted_by_time=True):
     """
     """
     from transport.udp import udp_stream
     result = udp_stream.streams().values()
     if sorted_by_time:
         result.sort(key=lambda stream: stream.started)
     return result
コード例 #2
0
 def list_streams(self, sorted_by_time=True):
     """
     
     """
     from transport.udp import udp_stream
     result = udp_stream.streams().values()
     if sorted_by_time:
         result.sort(key=lambda stream: stream.started)
     return result
コード例 #3
0
 def find_stream(self, stream_id=None, transfer_id=None):
     """
     """
     from transport.udp import udp_stream
     for stream in udp_stream.streams().values():
         if stream_id and stream_id == stream.consumer.stream_id:
             return stream.consumer
         if transfer_id and transfer_id == stream.consumer.transfer_id:
             return stream.consumer
     return None
コード例 #4
0
 def list_streams(self, sorted_by_time=True):
     """
     """
     from transport.udp import udp_stream
     result = []
     for stream in udp_stream.streams().values():
         result.append(stream.consumer)
     if sorted_by_time:
         result.sort(key=lambda stream: stream.started)
     return result
コード例 #5
0
 def _send(c):
     from transport.udp import udp_stream
     for idurl in sys.argv[2:]:
         print('_send', list(udp_stream.streams().keys()))
         p = signed.Packet(commands.Data(), my_id.getLocalID(),
                           my_id.getLocalID(), 'packet%d' % c,
                           bpio.ReadBinaryFile(sys.argv[1]), idurl)
         gateway.outbox(p)
     if c > 1:
         reactor.callLater(0.01, _send, c - 1)
コード例 #6
0
 def _send(c):
     from transport.udp import udp_stream
     for idurl in sys.argv[2:]:
         print '_send', udp_stream.streams().keys()
         p = signed.Packet(commands.Data(),
                           my_id.getLocalID(),
                           my_id.getLocalID(),
                           'packet%d' % c,
                           bpio.ReadBinaryFile(sys.argv[1]),
                           idurl)
         gateway.outbox(p)
     if c > 1:
         reactor.callLater(0.01, _send, c - 1)