Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / eventlet / convenience.pyc
Size: Mime:
ó
 ‹EYc
@s>ddlZddlmZddlmZddlmZddlmZddlmZ	ej
dd„Zej
dd	„Z
d
efd„ƒYZd„Zd
d„Zd„ZyddlmZejZWnfek
r9yddlmZWnek
rd„Zq:Xddedddeedd„	ZnXdS(iÿÿÿÿN(tgreenio(t	greenpool(tgreenthread(tsocket(t	greenletscCsBtj|tjƒ}|dk	r1|j|ƒn|j|ƒ|S(sfConvenience function for opening client sockets.

    :param addr: Address of the server to connect to.  For TCP sockets, this is a (host, port) tuple.
    :param family: Socket family, optional.  See :mod:`socket` documentation for available families.
    :param bind: Local address to bind to, optional.
    :return: The connected green socket object.
    N(RtSOCK_STREAMtNonetbindtconnect(taddrtfamilyRtsock((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyR
s

i2cCstj|tjƒ}tjd dkrD|jtjtjdƒnttdƒro|jtjtjdƒn|j	|ƒ|j
|ƒ|S(sBConvenience function for opening server sockets.  This
    socket can be used in :func:`~eventlet.serve` or a custom ``accept()`` loop.

    Sets SO_REUSEADDR on the socket to save on annoyance.

    :param addr: Address to listen on.  For TCP sockets, this is a (host, port)  tuple.
    :param family: Socket family, optional.  See :mod:`socket` documentation for available families.
    :param backlog:

        The maximum number of queued connections. Should be at least 1; the maximum
        value is system-dependent.

    :return: The listening green socket object.
    itwinitSO_REUSEPORT(RRtsystplatformt
setsockoptt
SOL_SOCKETtSO_REUSEADDRthasattrR
Rtlisten(R	R
tbacklogR((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyRs

t	StopServecBseZdZRS(sEException class used for quitting :func:`~eventlet.serve` gracefully.(t__name__t
__module__t__doc__(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyR3scCsay z|jƒWd|jƒXWn:tjk
r6n'tk
r\tj|tjƒŒnXdS(N(	twaittclosetgreenlettGreenletExitt	ExceptionRtkillRtexc_info(ttt	server_gttconn((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyt
_stop_checker8s
iècCsŽtj|ƒ}tjƒ}xltr‰yM|jƒ\}}|j|||ƒ}|jt||ƒd\}}}Wqt
k
r…dSXqWdS(sRuns a server on the supplied socket.  Calls the function *handle* in a
    separate greenthread for every incoming client connection.  *handle* takes
    two arguments: the client socket object, and the client address::

        def myhandle(client_sock, client_addr):
            print("client connected", client_addr)

        eventlet.serve(eventlet.listen(('127.0.0.1', 9999)), myhandle)

    Returning from *handle* closes the client socket.

    :func:`serve` blocks the calling greenthread; it won't return until
    the server completes.  If you desire an immediate return,
    spawn a new greenthread for :func:`serve`.

    Any uncaught exceptions raised in *handle* are raised as exceptions
    from :func:`serve`, terminating the server, so be sure to be aware of the
    exceptions your application can raise.  The return value of *handle* is
    ignored.

    Raise a :class:`~eventlet.StopServe` exception to gracefully terminate the
    server -- that's the only way to get the server() function to return rather
    than raise.

    The value in *concurrency* controls the maximum number of
    greenthreads that will be open at any time handling requests.  When
    the server hits the concurrency limit, it stops accepting new
    connections until the existing ones complete.
    N(NNN(Rt	GreenPoolRt
getcurrenttTruetaccepttspawntlinkR$RR(RthandletconcurrencytpoolR"R#R	tgt((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pytserveDs	
cOst|||ŽS(sxConvenience function for converting a regular socket into an
    SSL socket.  Has the same interface as :func:`ssl.wrap_socket`,
    but can also use PyOpenSSL. Though, note that it ignores the
    `cert_reqs`, `ssl_version`, `ca_certs`, `do_handshake_on_connect`,
    and `suppress_ragged_eofs` arguments when using PyOpenSSL.

    The preferred idiom is to call wrap_ssl directly on the creation
    method, e.g., ``wrap_ssl(connect(addr))`` or
    ``wrap_ssl(listen(addr), server_side=True)``. This way there is
    no "naked" socket sitting around to accidentally corrupt the SSL
    session.

    :return Green SSL object.
    (t
wrap_ssl_impl(Rtatkw((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pytwrap_sslos(tssl(tSSLcOstdƒ‚dS(NsPTo use SSL with Eventlet, you must install PyOpenSSL or use Python 2.6 or later.(tImportError(R1R2((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyR0ˆsc
Cs“tjtjƒ}
|dk	r.|
j|ƒn|dk	rJ|
j|ƒn|
jtjd„ƒtj|
|ƒ}|r…|j	ƒn
|j
ƒ|S(NcWstS(N(R'(tx((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyt<lambda>–s(R5tContextt
SSLv23_METHODRtuse_certificate_filetuse_privatekey_filet
set_verifytVERIFY_NONEt
Connectiontset_accept_statetset_connect_state(Rtkeyfiletcertfiletserver_sidet	cert_reqstssl_versiontca_certstdo_handshake_on_connecttsuppress_ragged_eofstcipherstcontextt
connection((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyR0Œs

(RteventletRRRteventlet.greenRteventlet.supportRRtAF_INETRRRRRR$R/R3R4twrap_socketR0R6teventlet.green.OpenSSLR5tFalseR'(((sI/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/convenience.pyt<module>s.	+