§
    cÌc�  ã                   óN   — d Z ddlZddlZddlmZ dad„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ ZdS )z*Signal handling for the smart server code.é    Né   )Útracec                 ó(  — t           €dS t          j        d¦  «         t                                ¦   «         D ]Z}	  |¦   «         }|�
 |¦   «          Œ# t          $ r ‚ t
          $ r* t          j        d¦  «         t          j        ¦   «          Y ŒWw xY wdS )zÅThis is the actual function that is registered for handling SIGHUP.

    It will call out to all the registered functions, letting them know that a
    graceful termination has been requested.
    Nz2Caught SIGHUP, sending graceful shutdown requests.z-Error occurred while running SIGHUP handlers:)Ú
_on_sighupr   ÚmutterÚ	valuerefsÚKeyboardInterruptÚ	ExceptionÚlog_exception_quietly)Úsignal_numberÚinterrupted_frameÚrefÚcbs       ú:/usr/lib/python3/dist-packages/breezy/bzr/smart/signals.pyÚ_sighup_handlerr   #   s¼   € õ ÐØˆÝ	„LÐEÑFÔFÐFÝ×#Ò#Ñ%Ô%ð 	*ð 	*ˆð	*Ø�‘”ˆBØˆ~Ø�‘”�øøÝ ð 	ð 	ð 	ØÝð 	*ð 	*ð 	*ÝŒLÐHÑIÔIÐIÝÔ'Ñ)Ô)Ð)Ð)Ð)ð	*øøøð	*ð 	*s   ºAÁ;BÂBc                  ó    — t          t          dd¦  «        €d} n$t          j        t          j        t          ¦  «        } t	          ¦   «         }| |fS )z&Setup a handler for the SIGHUP signal.ÚSIGHUPN)ÚgetattrÚsignalr   r   Ú_setup_on_hangup_dict)Ú
old_signalÚold_dicts     r   Úinstall_sighup_handlerr   8   sF   € å�v�x Ñ&Ô&Ð.ð ˆ
ˆ
å”]¥6¤=µ/ÑBÔBˆ
Ý$Ñ&Ô&€HØ�xÐÐó    c                  ó:   — t           } t          j        ¦   «         a | S )zóCreate something for _on_sighup.

    This is done when we install the sighup handler, and for tests that want to
    test the functionality. If this hasn'nt been called, then
    register_on_hangup is a no-op. As is unregister_on_hangup.
    )r   ÚweakrefÚWeakValueDictionary)Úolds    r   r   r   D   s   € õ €CÝÔ,Ñ.Ô.€JØ€Jr   c                 óV   — | \  }}|�t          j         t           j        |¦  «         |adS )z@Pass in the returned value from install_sighup_handler to reset.N)r   r   r   )Úorigr   r   s      r   Úrestore_sighup_handlerr!   Q   s1   € ð  Ñ€J�ØÐÝŒ•f”m ZÑ0Ô0Ð0Ø€J€J€Jr   c                 ó,   — t           €dS |t           | <   dS )zBRegister for us to call a_callable as part of a graceful shutdown.N)r   )Ú
identifierÚ
a_callables     r   Úregister_on_hangupr%   `   s   € åÐØˆØ'…JˆzÑÐÐr   c                 ó®   — t           €dS 	 t           | = dS # t          $ r ‚ t          $ r+ t          j        d¦  «         t          j        ¦   «          Y dS w xY w)z2Remove a callback from being called during sighup.Nz+Error occurred during unregister_on_hangup:)r   r	   r
   r   r   r   )r#   s    r   Úunregister_on_hangupr'   g   s{   € åÐØˆð&Ý�zÐ"Ð"Ð"øÝð ð ð ØÝð &ð &ð &õ 	ŒÐBÑCÔCÐCÝÔ#Ñ%Ô%Ð%Ð%Ð%Ð%ð	&øøøs   ‹ •;AÁA)Ú__doc__r   r   Ú r   r   r   r   r   r!   r%   r'   © r   r   ú<module>r+      sœ   ðð" 1Ð 0à €€€Ø €€€à Ð Ð Ð Ð Ð ð €
ð*ð *ð *ð*	 ð 	 ð 	 ð
ð 
ð 
ðð ð ð(ð (ð (ð&ð &ð &ð &ð &r   