예제 #1
0
 def close(self):
     """Close connection and deregister active listeners"""
     AsyncDataStream.close(self)
     self.cleanup_running = True
     for listener in self.bth_throughput_listeners.values():
         listener.close()
     self.bth_throughput_listeners = {}
     self.cleanup_running = False
예제 #2
0
 def __init__(self, btm, *args, **kwargs):
     AsyncDataStream.__init__(self, *args, **kwargs)
     BTControlConnectionBase.__init__(self)
     self.btm = btm
     # sequence ids
     self.snum_btc = 0
     self.snum_bthsets = 0
     self.bth_throughput_listeners = {}
     self.cleanup_running = False
예제 #3
0
파일: logs2stdout.py 프로젝트: sh01/taf
  def start_stdio(self):
    fl_in = AsyncDataStream(self.ed, os.fdopen(sys.stdin.fileno(), 'rb', 0, closefd=False))
    fl_out = AsyncDataStream(self.ed, os.fdopen(sys.stdout.fileno(), 'wb', 0, closefd=False), read_r=False)

    sd = ed_shutdown(self.ed)
    fl_in.process_close = sd
    fl_out.process_close = sd

    self.stream = EventStreamServer(fl_in, fl_out)
    self.stream.watch_files = self._watch_files
    self._start_watch()
예제 #4
0
 def request_send(self, event_dispatcher, result_callback, error_callback):
    """Open connection to announce url, open and send request"""
    if not (self.connection is None):
       raise TrackerRequestError("Request {0!a} is still pending.".format(self.connection))
    
    try:
       request_string = self.request_build()
    except urllib.request.URLError:
       self.log(30, 'Error building request for {0!a}:'.format(self.req_url_get()), exc_info=True)
       error_callback(self)
       return
    
    try:
       self.connection = AsyncDataStream.build_sock_connect(event_dispatcher,
          self.address_get(default_port=80))
    except socket.error:
       self.connection = None
       self.result_callback = None
       self.error_callback = None
       error_callback(self)
       return
    
    self.connection.process_input = self.conn_input_handle
    self.connection.process_close = self.conn_close_handle
    self.result_callback = result_callback
    self.error_callback = error_callback
    
    self.connection.send_bytes((request_string,))
예제 #5
0
파일: logs2stdout.py 프로젝트: sh01/taf
    def start_stdio(self):
        fl_in = AsyncDataStream(
            self.ed, os.fdopen(sys.stdin.fileno(), 'rb', 0, closefd=False))
        fl_out = AsyncDataStream(self.ed,
                                 os.fdopen(sys.stdout.fileno(),
                                           'wb',
                                           0,
                                           closefd=False),
                                 read_r=False)

        sd = ed_shutdown(self.ed)
        fl_in.process_close = sd
        fl_out.process_close = sd

        self.stream = EventStreamServer(fl_in, fl_out)
        self.stream.watch_files = self._watch_files
        self._start_watch()
예제 #6
0
파일: cc_client.py 프로젝트: sh01/liasis
 def __init__(self, *args, **kwargs):
    BTControlConnectionClient.__init__(self)
    AsyncDataStream.__init__(self, *args, **kwargs)