
    =*fN                         S r SrSrSSKrSSKJr  SSKJr  SSKJ	r	  S	S
K
JrJr   " S S\5      r\" \S5      (       d  \R                  \l        gg)zCyril Jaquierz Copyright (c) 2004 Cyril JaquierGPL    N)Thread)abstractmethod   )Utils   )
excepthookprctl_set_th_namec                      ^  \ rS rSrSrSU 4S jjrU 4S jr\SS j5       rU 4S jr	\S 5       r
S r\S	 5       rU 4S
 jrSrU =r$ )
JailThread#   a  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.
c                    >^ ^ [         [        T ]  US9  ST l        S T l        ST l        [        R                  T l        T R                  mUU 4S jnUT l	        g )N)nameTFc                     >  T" U 0 UD6  TR                  5         g ! [         a<  n[        b   [        [        R                  " 5       6    S nAg [        U5         S nAg S nAff = fN)onStop	Exceptionsysr	   exc_infoprint)argskwargserunselfs      </usr/lib/python3/dist-packages/fail2ban/server/jailthread.pyrun_with_except_hook1JailThread.__init__.<locals>.run_with_except_hookC   sL    
KKM
   
1XXs    
A""AAA")
superr   __init__daemonactiveidler   DEFAULT_SLEEP_TIME	sleeptimer   )r   r   r   r   	__class__s   `  @r   r    JailThread.__init__4   sP    
D""-$+$+$)++$. 	# "$(    c                 R   > [        U R                  5        [        [        U ]  5       $ r   )r
   r   r   r   
_bootstrapr   r&   s    r   r*   JailThread._bootstrapQ   s    DII	z4	+	--r(   c                     g)z>Abstract - Should provide status information.
                N )r   flavors     r   statusJailThread.statusU        r(   c                 8   > SU l         [        [        U ]  5         g)z4Sets active flag and starts thread.
                TN)r"   r   r   startr+   s    r   r4   JailThread.start[   s     $+
D!r(   c                     g)z@Abstract - Called when thread ends (after run).
                Nr.   r   s    r   r   JailThread.onStopa   r2   r(   c                     SU l         g)zOSets `active` property to False, to flag run method to return.
                FN)r"   r7   s    r   stopJailThread.stopg   s     $+r(   c                     g)zQAbstract - Called when thread starts, thread stops when returns.
                Nr.   r7   s    r   r   JailThread.runl   r2   r(   c                 F   > U R                   b  [        [        U ]  5         gg)zmSafer join, that could be called also for not started (or ended) threads (used for cleanup).
                N)r"   r   r   joinr+   s    r   r?   JailThread.joinr   s!     
[[T! r(   )r"   r!   r#   r   r%   r   )basic)__name__
__module____qualname____firstlineno____doc__r    r*   r   r0   r4   r   r:   r   r?   __static_attributes____classcell__)r&   s   @r   r   r   #   sb     ":/  
"  

  
" "r(   r   isAlive)
__author____copyright____license__r   	threadingr   abcr   utilsr   helpersr	   r
   r   hasattris_aliverI   r.   r(   r   <module>rS      sV   . 
2 
    3V" V"r z9%%!*** &r(   