dhcpkit.ipv6.server.worker module¶
Worker process for handling requests using multiprocessing.
-
dhcpkit.ipv6.server.worker.
current_message_handler
= None¶ Type: MessageHandler
-
dhcpkit.ipv6.server.worker.
get_interface_name_from_options
(options: Iterable)[source]¶ Get the interface name from the given options and decode it as unicode
Parameters: options – A list of options Returns: The interface name
-
dhcpkit.ipv6.server.worker.
handle_message
(incoming_packet: dhcpkit.ipv6.server.listeners.IncomingPacketBundle, replier: dhcpkit.ipv6.server.listeners.Replier)[source]¶ Handle a single incoming request. This is supposed to be called in a separate worker thread that has been initialised with setup_worker().
Parameters: - incoming_packet – The raw incoming request
- replier – The object that will send replies for us
Returns: The packet to reply with and the destination
-
dhcpkit.ipv6.server.worker.
logger
= None¶ Type: logging.Logger
-
dhcpkit.ipv6.server.worker.
logging_handler
= None¶ Type: WorkerQueueHandler
-
dhcpkit.ipv6.server.worker.
parse_incoming_request
(incoming_packet: dhcpkit.ipv6.server.listeners.IncomingPacketBundle) → dhcpkit.ipv6.server.transaction_bundle.TransactionBundle[source]¶ Parse the incoming packet and add a RelayServerMessage around it containing the meta-data received from the listener.
Parameters: incoming_packet – The received packet Returns: The parsed message in a transaction bundle
-
dhcpkit.ipv6.server.worker.
setup_worker
(message_handler: dhcpkit.ipv6.server.message_handler.MessageHandler, logging_queue: <bound method BaseContext.Queue of <multiprocessing.context.DefaultContext object at 0x7f4f9be204a8>>, lowest_log_level: int, statistics: dhcpkit.ipv6.server.statistics.ServerStatistics, master_pid: int)[source]¶ This function will be called after a new worker process has been created. Its purpose is to set the global variables in this specific worker process so that they can be reused across multiple requests. Otherwise we would have to pickle them each and every time, and because they are static that would be a waste.
Parameters: - message_handler – The message handler for the incoming requests
- logging_queue – The queue where we can deposit log messages so the main process can log them
- lowest_log_level – The lowest log level that is going to be handled by the main process
- statistics – Container for shared memory with statistics counters
- master_pid – The PID of the master process, in case we have critical errors while initialising
Type: ServerStatistics