
    Tf	                     *    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      B/var/www/html/env/lib/python3.11/site-packages/gunicorn/systemd.py
listen_fdsr      s    0 bjnn\1--
.
.CRZ^^L!4455JRY[[  q +

|T***

|T***J    Fc                    t           j                            d          }|dS 	 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 # |rt           j                            d           |                                 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'   1   s1    :>>/**D|}V^V->AT-TUU7c>>$qrr(?DTU\\'**++++ L L L;dKKKKKL  	,JNN?+++

  	,JNN?+++

s*   BB2 1D 2!CD CD 7E)T)F)r   r   SD_LISTEN_FDS_STARTr   r'    r   r   <module>r*      sR    
			  " " " "J     r   