§
    k•jó	  ã                   ó*   — d dl Z d dlZdZdd„Zdd„ZdS )	é    Né   Tc                 óp  — t          t          j                             dd¦  «        ¦  «        }t          t          j                             dd¦  «        ¦  «        }|t          j        ¦   «         k    rdS | r@t          j                             dd¦  «         t          j                             dd¦  «         |S )a`  
    Get the number of sockets inherited from systemd socket activation.

    :param unset_environment: clear systemd environment variables unless False
    :type unset_environment: bool
    :return: the number of sockets to inherit from systemd socket activation
    :rtype: int

    Returns zero immediately if $LISTEN_PID is not set to the current pid.
    Otherwise, returns the number of systemd activation sockets specified by
    $LISTEN_FDS.

    When $LISTEN_PID matches the current pid, unsets the environment variables
    unless the ``unset_environment`` flag is ``False``.

    .. note::
        Unlike the sd_listen_fds C function, this implementation does not set
        the FD_CLOEXEC flag because the gunicorn arbiter never needs to do this.

    .. seealso::
        `<https://www.freedesktop.org/software/systemd/man/sd_listen_fds.html>`_

    Ú
LISTEN_FDSr   Ú
LISTEN_PIDN)ÚintÚosÚenvironÚgetÚgetpidÚpop)Úunset_environmentÚfdsÚ
listen_pids      ú_/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/gunicorn/systemd.pyÚ
listen_fdsr      s�   € õ0 �bŒj�nŠn˜\¨1Ñ-Ô-Ñ
.Ô
.€CÝ•R”Z—^’^ L°!Ñ4Ô4Ñ5Ô5€Jà•R”Y‘[”[Ò Ð Øˆqàð +Ý
Œ
�Š�| TÑ*Ô*Ð*Ý
Œ
�Š�| TÑ*Ô*Ð*à€Jó    Fc                 ó¦  — t           j                             d¦  «        }|€dS d}	 t          j        t          j        t          j        t          j        z  ¦  «        }|d         dk    rd|dd…         z   }|                     |¦  «         |                     |  	                    d¦  «        ¦  «         n'# t          $ r |                     dd	¬
¦  «         Y nw xY w|rt           j                             d¦  «         |�|                     ¦   «          dS dS # |rt           j                             d¦  «         |�|                     ¦   «          w w xY w)a  Send a notification to systemd. state is a string; see
    the man page of sd_notify (http://www.freedesktop.org/software/systemd/man/sd_notify.html)
    for a description of the allowable values.

    If the unset_environment parameter is True, sd_notify() will unset
    the $NOTIFY_SOCKET environment variable before returning (regardless of
    whether the function call itself succeeded or not). Further calls to
    sd_notify() will then fail, but the variable is no longer inherited by
    child processes.
    ÚNOTIFY_SOCKETNr   ú@ú é   zutf-8z$Exception while invoking sd_notify()T)Úexc_info)r   r	   r
   ÚsocketÚAF_UNIXÚ
SOCK_DGRAMÚSOCK_CLOEXECÚconnectÚsendallÚencodeÚ	ExceptionÚdebugr   Úclose)ÚstateÚloggerr   ÚaddrÚsocks        r   Ú	sd_notifyr'   0   sO  € õ Œ:�>Š>˜/Ñ*Ô*€DØ€|àˆØ€DðÝŒ}�Vœ^­VÔ->ÅÔATÑ-TÑUÔUˆØ�Œ7�cŠ>ˆ>Ø˜$˜q˜r˜rœ(‘?ˆDØ�Š�TÑÔÐØ�Š�U—\’\ 'Ñ*Ô*Ñ+Ô+Ð+Ð+øÝð Lð Lð LØ�ŠÐ;ÀdˆÑKÔKÐKÐKÐKðLøøøð ð 	,ÝŒJ�NŠN˜?Ñ+Ô+Ð+ØÐØ�JŠJ‰LŒLˆLˆLˆLð Ðøð ð 	,ÝŒJ�NŠN˜?Ñ+Ô+Ð+ØÐØ�JŠJ‰LŒLˆLˆLð øøøs*   §BB4 Â3D Â4!CÃD ÃCÃD Ä:E)T)F)r   r   ÚSD_LISTEN_FDS_STARTr   r'   © r   r   ú<module>r*      sR   ðð
 
€	€	€	Ø €€€àÐ ð"ð "ð "ð "ðJð ð ð ð ð r   