File: //lib/python3.9/site-packages/fail2ban/server/__pycache__/jailthread.cpython-39.opt-2.pyc
a
H��q B��� @ sn d Z dZdZddlZddlmZ ddlmZ ddlm Z d d
l
mZmZ G dd� de�Z
ee
d
�sje
je
_dS )z
Cyril Jaquierz Copyright (c) 2004 Cyril JaquierZGPL� N)�Thread)�abstractmethod� )�Utils� )�
excepthook�prctl_set_th_namec st e Zd ZdZd� fdd� Z� fdd�Zeddd ��Z� fd
d�Zedd
� �Z dd� Z
edd� �Z� fdd�Z� Z
S )�
JailThreada Abstract class for threading elements in Fail2Ban.
Attributes
----------
daemon
ident
name
status
active : bool
Control the state of the thread.
idle : bool
Control the idle state of the thread.
sleeptime : int
The time the thread sleeps for in the loop.
Nc sJ t t��j|d� d�_d �_d�_tj�_�j � � �fdd�}|�_ d S )N)�nameTFc
sb z� | i |�� �� � W nB ty\ } z*td ur@tt�� � nt|� W Y d }~n
d }~0 0 d S �N)�onStop� Exception�sysr �exc_info�print)�args�kwargs�e��run�self� �>/usr/lib/python3.9/site-packages/fail2ban/server/jailthread.py�run_with_except_hookC s z1JailThread.__init__.<locals>.run_with_except_hook)
�superr �__init__�daemon�activeZidler ZDEFAULT_SLEEP_TIMEZ sleeptimer )r r
r �� __class__r r r 4 s zJailThread.__init__c s t | j� tt| ��� S r )r r
r r �
_bootstrap�r r r r r Q s
zJailThread._bootstrap�basicc C s dS )z0Abstract - Should provide status information.
Nr )r Zflavorr r r �statusU s zJailThread.statusc s d| _ tt| ��� dS )z&Sets active flag and starts thread.
TN)r r r �startr! r r r r$ [ s zJailThread.startc C s dS )z2Abstract - Called when thread ends (after run).
Nr r! r r r r a s zJailThread.onStopc C s
d| _ dS )zASets `active` property to False, to flag run method to return.
FN)r r! r r r �stopg s zJailThread.stopc C s dS )zCAbstract - Called when thread starts, thread stops when returns.
Nr r! r r r r l s zJailThread.runc s | j durtt| ��� dS )z` Safer join, that could be called also for not started (or ended) threads (used for cleanup).
N)r r r �joinr! r r r r&