webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Public Attributes | List of all members
webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler Class Reference
Inheritance diagram for webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler:

Public Member Functions

def __init__ (self, request, dispatcher)
 
def start (self)
 
def add_channel_slots (self, slots, send_quota)
 
def wait_until_done (self, timeout=None)
 
def notify_write_data_done (self, channel_id)
 
def send_control_data (self, data)
 
def send_data (self, channel_id, data)
 
def dispatch_message (self, message)
 
def notify_worker_done (self, channel_id)
 
def notify_reader_done (self)
 
def notify_writer_done (self)
 
def fail_physical_connection (self, code, message)
 
def fail_logical_channel (self, channel_id, code, message)
 

Public Attributes

 original_request
 
 dispatcher
 
 physical_connection
 
 physical_stream
 

Detailed Description

Multiplexing handler. When a handler starts, it launches three
threads; the reader thread, the writer thread, and a worker thread.

The reader thread reads data from the physical stream, i.e., the
ws_stream object of the underlying websocket connection. The reader
thread interprets multiplexed frames and dispatches them to logical
channels. Methods of this class are mostly called by the reader thread.

The writer thread sends multiplexed frames which are created by
logical channels via the physical connection.

The worker thread launched at the starting point handles the
"Implicitly Opened Connection". If multiplexing handler receives
an AddChannelRequest and accepts it, the handler will launch a new worker
thread and dispatch the request to it.

Constructor & Destructor Documentation

◆ __init__()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.__init__ (   self,
  request,
  dispatcher 
)
Constructs an instance.

Args:
    request: mod_python request of the physical connection.
    dispatcher: Dispatcher instance (dispatch.Dispatcher).

Member Function Documentation

◆ add_channel_slots()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.add_channel_slots (   self,
  slots,
  send_quota 
)
Adds channel slots.

Args:
    slots: number of slots to be added.
    send_quota: initial send quota for slots.

◆ dispatch_message()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.dispatch_message (   self,
  message 
)
Dispatches message. The reader thread calls this method.

Args:
    message: a message that contains encapsulated frame.
Raises:
    PhysicalConnectionError: if the message contains physical
connection level errors.
    LogicalChannelError: if the message contains logical channel
level errors.

◆ fail_logical_channel()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.fail_logical_channel (   self,
  channel_id,
  code,
  message 
)
Fail a logical channel.

Args:
    channel_id: channel id.
    code: drop reason code.
    message: drop message.

◆ fail_physical_connection()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.fail_physical_connection (   self,
  code,
  message 
)
Fail the physical connection.

Args:
    code: drop reason code.
    message: drop message.

◆ notify_reader_done()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.notify_reader_done (   self)
This method is called by the reader thread when the reader has
finished.

◆ notify_worker_done()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.notify_worker_done (   self,
  channel_id 
)
Called when a worker has finished.

Args:
    channel_id: channel id corresponded with the worker.

◆ notify_write_data_done()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.notify_write_data_done (   self,
  channel_id 
)
Called by the writer thread when a write operation has done.

Args:
    channel_id: objective channel id.

◆ notify_writer_done()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.notify_writer_done (   self)
This method is called by the writer thread when the writer has
finished.

◆ send_control_data()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.send_control_data (   self,
  data 
)
Sends data via the control channel.

Args:
    data: data to be sent.

◆ send_data()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.send_data (   self,
  channel_id,
  data 
)
Sends data via given logical channel. This method is called by
worker threads.

Args:
    channel_id: objective channel id.
    data: data to be sent.

◆ start()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.start (   self)
Starts the handler.

Raises:
    MuxUnexpectedException: when the handler already started, or when
opening handshake of the default channel fails.

◆ wait_until_done()

def webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.wait_until_done (   self,
  timeout = None 
)
Waits until all workers are done. Returns False when timeout has
occurred. Returns True on success.

Args:
    timeout: timeout in sec.

Member Data Documentation

◆ dispatcher

webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.dispatcher

◆ original_request

webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.original_request

◆ physical_connection

webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.physical_connection

◆ physical_stream

webkitpy.thirdparty.mod_pywebsocket.mux._MuxHandler.physical_stream

The documentation for this class was generated from the following file: