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
a8923303
Commit
a8923303
authored
Sep 09, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use _socket.socket instead of _original_socket
- since _socket is not monkey patched, not need to save stuff from
parent
1acd1e05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
gevent/socket.py
gevent/socket.py
+8
-8
No files found.
gevent/socket.py
View file @
a8923303
...
...
@@ -23,9 +23,9 @@
__all__
=
[
'GreenSocket'
,
'GreenFile'
,
'GreenPipe'
]
import
_socket
_original_socket
=
_socket
.
socket
_original_fromfd
=
_socket
.
fromfd
_original_socketpair
=
_socket
.
socketpair
_original_socket
=
_socket
.
socket
# XXX remove it
_original_fromfd
=
_socket
.
fromfd
# XXX remove it
_original_socketpair
=
_socket
.
socketpair
# XXX remove it
error
=
_socket
.
error
timeout
=
_socket
.
timeout
__socket__
=
__import__
(
'socket'
)
...
...
@@ -144,7 +144,7 @@ class GreenSocket(object):
def
__init__
(
self
,
family_or_realsock
=
_socket
.
AF_INET
,
*
args
,
**
kwargs
):
if
isinstance
(
family_or_realsock
,
(
int
,
long
)):
self
.
fd
=
_
original_
socket
(
family_or_realsock
,
*
args
,
**
kwargs
)
self
.
fd
=
_
socket
.
socket
(
family_or_realsock
,
*
args
,
**
kwargs
)
self
.
timeout
=
_socket
.
getdefaulttimeout
()
else
:
if
hasattr
(
family_or_realsock
,
'_sock'
):
...
...
@@ -466,12 +466,12 @@ class GreenSSL(GreenSocket):
def
socketpair
(
*
args
):
one
,
two
=
_
original_
socketpair
(
*
args
)
one
,
two
=
_
socket
.
socketpair
(
*
args
)
return
GreenSocket
(
one
),
GreenSocket
(
two
)
def
fromfd
(
*
args
):
return
GreenSocket
(
_
original_
fromfd
(
*
args
))
return
GreenSocket
(
_
socket
.
fromfd
(
*
args
))
def
socket_bind_and_listen
(
descriptor
,
addr
=
(
''
,
0
),
backlog
=
50
):
set_reuse_addr
(
descriptor
)
...
...
@@ -513,7 +513,7 @@ def ssl_listener(address, private_key, certificate):
which accepts connections forever and spawns greenlets for
each incoming connection.
"""
r
=
_
original_
socket
()
r
=
_
socket
.
socket
()
sock
=
wrap_ssl000
(
r
,
private_key
,
certificate
)
socket_bind_and_listen
(
sock
,
address
)
return
sock
...
...
@@ -604,7 +604,7 @@ def create_connection_ssl(address, timeout=_GLOBAL_DEFAULT_TIMEOUT):
af
,
socktype
,
proto
,
canonname
,
sa
=
res
sock
=
None
try
:
_sock
=
_
original_
socket
(
af
,
socktype
,
proto
)
_sock
=
_
socket
.
socket
(
af
,
socktype
,
proto
)
sock
=
wrap_ssl000
(
_sock
)
if
timeout
is
not
_GLOBAL_DEFAULT_TIMEOUT
:
sock
.
settimeout
(
timeout
)
...
...
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