Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
ba9883cd
Commit
ba9883cd
authored
Mar 22, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into select-errors
parents
8bd6e622
48202d1f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
18 deletions
+39
-18
examples/psycopg2_pool.py
examples/psycopg2_pool.py
+6
-3
gevent/_socket2.py
gevent/_socket2.py
+11
-0
gevent/_ssl3.py
gevent/_ssl3.py
+8
-8
gevent/_sslgte279.py
gevent/_sslgte279.py
+6
-6
gevent/baseserver.py
gevent/baseserver.py
+3
-0
gevent/ssl.py
gevent/ssl.py
+4
-0
gevent/wsgi.py
gevent/wsgi.py
+1
-1
No files found.
examples/psycopg2_pool.py
View file @
ba9883cd
...
...
@@ -34,7 +34,7 @@ def gevent_wait_callback(conn, timeout=None):
extensions
.
set_wait_callback
(
gevent_wait_callback
)
class
DatabaseConnectionPool
(
object
):
class
Abstract
DatabaseConnectionPool
(
object
):
def
__init__
(
self
,
maxsize
=
100
):
if
not
isinstance
(
maxsize
,
integer_types
):
...
...
@@ -43,6 +43,9 @@ class DatabaseConnectionPool(object):
self
.
pool
=
Queue
()
self
.
size
=
0
def
create_connection
(
self
):
raise
NotImplementedError
()
def
get
(
self
):
pool
=
self
.
pool
if
self
.
size
>=
self
.
maxsize
or
pool
.
qsize
():
...
...
@@ -134,14 +137,14 @@ class DatabaseConnectionPool(object):
yield
item
class
PostgresConnectionPool
(
DatabaseConnectionPool
):
class
PostgresConnectionPool
(
Abstract
DatabaseConnectionPool
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
connect
=
kwargs
.
pop
(
'connect'
,
connect
)
maxsize
=
kwargs
.
pop
(
'maxsize'
,
None
)
self
.
args
=
args
self
.
kwargs
=
kwargs
DatabaseConnectionPool
.
__init__
(
self
,
maxsize
)
Abstract
DatabaseConnectionPool
.
__init__
(
self
,
maxsize
)
def
create_connection
(
self
):
return
self
.
connect
(
*
self
.
args
,
**
self
.
kwargs
)
...
...
gevent/_socket2.py
View file @
ba9883cd
...
...
@@ -100,6 +100,8 @@ class socket(object):
to be aware of or may document a method the standard library does not.
"""
# pylint:disable=too-many-public-methods
def
__init__
(
self
,
family
=
AF_INET
,
type
=
SOCK_STREAM
,
proto
=
0
,
_sock
=
None
):
if
_sock
is
None
:
self
.
_sock
=
_realsocket
(
family
,
type
,
proto
)
...
...
@@ -463,6 +465,15 @@ class socket(object):
type
=
property
(
lambda
self
:
self
.
_sock
.
type
)
proto
=
property
(
lambda
self
:
self
.
_sock
.
proto
)
def
fileno
(
self
):
return
self
.
_sock
.
fileno
()
def
getsockname
(
self
):
return
self
.
_sock
.
getsockname
()
def
getpeername
(
self
):
return
self
.
_sock
.
getpeername
()
# delegate the functions that we haven't implemented to the real socket object
_s
=
"def %s(self, *args): return self._sock.%s(*args)
\
n
\
n
"
...
...
gevent/_ssl3.py
View file @
ba9883cd
...
...
@@ -178,8 +178,8 @@ class SSLSocket(socket):
if
connected
:
# create the SSL object
try
:
self
.
_sslobj
=
self
.
context
.
_wrap_socket
(
self
.
_sock
,
server_side
,
server_hostname
)
self
.
_sslobj
=
self
.
_
context
.
_wrap_socket
(
self
.
_sock
,
server_side
,
server_hostname
)
if
do_handshake_on_connect
:
timeout
=
self
.
gettimeout
()
if
timeout
==
0.0
:
...
...
@@ -487,7 +487,7 @@ class SSLSocket(socket):
raise
self
.
_wait
(
self
.
_write_event
,
timeout_exc
=
_SSLErrorHandshakeTimeout
)
if
self
.
context
.
check_hostname
:
if
self
.
_
context
.
check_hostname
:
if
not
self
.
server_hostname
:
raise
ValueError
(
"check_hostname needs server_hostname "
"argument"
)
...
...
@@ -500,7 +500,7 @@ class SSLSocket(socket):
# connected at the time of the call. We connect it, then wrap it.
if
self
.
_connected
:
raise
ValueError
(
"attempt to connect already-connected SSLSocket!"
)
self
.
_sslobj
=
self
.
context
.
_wrap_socket
(
self
.
_sock
,
False
,
self
.
server_hostname
)
self
.
_sslobj
=
self
.
_
context
.
_wrap_socket
(
self
.
_sock
,
False
,
self
.
server_hostname
)
try
:
if
connect_ex
:
rc
=
socket
.
connect_ex
(
self
,
addr
)
...
...
@@ -532,10 +532,10 @@ class SSLSocket(socket):
SSL channel, and the address of the remote client."""
newsock
,
addr
=
socket
.
accept
(
self
)
newsock
=
self
.
context
.
wrap_socket
(
newsock
,
do_handshake_on_connect
=
self
.
do_handshake_on_connect
,
suppress_ragged_eofs
=
self
.
suppress_ragged_eofs
,
server_side
=
True
)
newsock
=
self
.
_
context
.
wrap_socket
(
newsock
,
do_handshake_on_connect
=
self
.
do_handshake_on_connect
,
suppress_ragged_eofs
=
self
.
suppress_ragged_eofs
,
server_side
=
True
)
return
newsock
,
addr
def
get_channel_binding
(
self
,
cb_type
=
"tls-unique"
):
...
...
gevent/_sslgte279.py
View file @
ba9883cd
...
...
@@ -572,7 +572,7 @@ class SSLSocket(socket):
raise
self
.
_wait
(
self
.
_write_event
,
timeout_exc
=
_SSLErrorHandshakeTimeout
)
if
self
.
context
.
check_hostname
:
if
self
.
_
context
.
check_hostname
:
if
not
self
.
server_hostname
:
raise
ValueError
(
"check_hostname needs server_hostname "
"argument"
)
...
...
@@ -585,7 +585,7 @@ class SSLSocket(socket):
# connected at the time of the call. We connect it, then wrap it.
if
self
.
_connected
:
raise
ValueError
(
"attempt to connect already-connected SSLSocket!"
)
self
.
_sslobj
=
self
.
context
.
_wrap_socket
(
self
.
_sock
,
False
,
self
.
server_hostname
,
ssl_sock
=
self
)
self
.
_sslobj
=
self
.
_
context
.
_wrap_socket
(
self
.
_sock
,
False
,
self
.
server_hostname
,
ssl_sock
=
self
)
try
:
if
connect_ex
:
rc
=
socket
.
connect_ex
(
self
,
addr
)
...
...
@@ -617,10 +617,10 @@ class SSLSocket(socket):
SSL channel, and the address of the remote client."""
newsock
,
addr
=
socket
.
accept
(
self
)
newsock
=
self
.
context
.
wrap_socket
(
newsock
,
do_handshake_on_connect
=
self
.
do_handshake_on_connect
,
suppress_ragged_eofs
=
self
.
suppress_ragged_eofs
,
server_side
=
True
)
newsock
=
self
.
_
context
.
wrap_socket
(
newsock
,
do_handshake_on_connect
=
self
.
do_handshake_on_connect
,
suppress_ragged_eofs
=
self
.
suppress_ragged_eofs
,
server_side
=
True
)
return
newsock
,
addr
def
makefile
(
self
,
mode
=
'r'
,
bufsize
=-
1
):
...
...
gevent/baseserver.py
View file @
ba9883cd
...
...
@@ -184,6 +184,9 @@ class BaseServer(object):
def
do_close
(
self
,
*
args
):
pass
def
do_read
(
self
):
raise
NotImplementedError
()
def
_do_read
(
self
):
for
_
in
xrange
(
self
.
max_accept
):
if
self
.
full
():
...
...
gevent/ssl.py
View file @
ba9883cd
...
...
@@ -4,6 +4,10 @@ Secure Sockets Layer (SSL/TLS) module.
from
gevent._compat
import
PY2
from
gevent._util
import
copy_globals
# things we expect to override, here for static analysis
def
wrap_socket
(
sock
,
**
kwargs
):
# pylint:disable=unused-argument
raise
NotImplementedError
()
if
PY2
:
if
hasattr
(
__import__
(
'ssl'
),
'SSLContext'
):
# It's not sufficient to check for >= 2.7.9; some distributions
...
...
gevent/wsgi.py
View file @
ba9883cd
...
...
@@ -9,7 +9,7 @@ pipelining, and not supporting SSL.
Use :mod:`gevent.pywsgi`
"""
from
gevent.pywsgi
import
*
# pylint:disable=wildcard-import
from
gevent.pywsgi
import
*
# pylint:disable=wildcard-import
,unused-wildcard-import
import
gevent.pywsgi
as
_pywsgi
__all__
=
_pywsgi
.
__all__
del
_pywsgi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment