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
564a7fa6
Commit
564a7fa6
authored
Apr 28, 2014
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: fix do_read() enough to run bench_sendall() PY3
parent
4c173c7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
12 deletions
+31
-12
gevent/_socket3.py
gevent/_socket3.py
+1
-0
gevent/server.py
gevent/server.py
+30
-12
No files found.
gevent/_socket3.py
View file @
564a7fa6
...
...
@@ -125,6 +125,7 @@ class socket(_socket.socket):
# Python Issue #7995: if no default timeout is set and the listening
# socket had a (non-zero) timeout, force the new socket in blocking
# mode to override platform-specific socket flags inheritance.
# XXX do we need to do this?
if
getdefaulttimeout
()
is
None
and
self
.
gettimeout
():
sock
.
setblocking
(
True
)
return
sock
,
addr
...
...
gevent/server.py
View file @
564a7fa6
...
...
@@ -4,7 +4,9 @@ import sys
import
_socket
from
gevent.baseserver
import
BaseServer
from
gevent.socket
import
EWOULDBLOCK
,
socket
from
gevent.hub
import
PYPY
from
gevent.hub
import
PYPY
,
PY3
if
PY3
:
from
io
import
BlockingIOError
__all__
=
[
'StreamServer'
,
'DatagramServer'
]
...
...
@@ -89,17 +91,33 @@ class StreamServer(BaseServer):
backlog
=
self
.
backlog
return
_tcp_listener
(
address
,
backlog
=
backlog
,
reuse_addr
=
self
.
reuse_addr
,
family
=
family
)
def
do_read
(
self
):
try
:
client_socket
,
address
=
self
.
socket
.
accept
()
except
_socket
.
error
as
err
:
if
err
.
args
[
0
]
==
EWOULDBLOCK
:
return
raise
sockobj
=
socket
(
_sock
=
client_socket
)
if
PYPY
:
client_socket
.
_drop
()
return
sockobj
,
address
if
PY3
:
def
do_read
(
self
):
sock
=
self
.
socket
try
:
fd
,
address
=
sock
.
_accept
()
except
BlockingIOError
:
if
sock
.
timeout
==
0.0
:
return
raise
sock
=
socket
(
sock
.
family
,
sock
.
type
,
sock
.
proto
,
fileno
=
fd
)
# XXX Python issue #7995?
return
sock
,
address
else
:
def
do_read
(
self
):
try
:
client_socket
,
address
=
self
.
socket
.
accept
()
except
_socket
.
error
as
err
:
if
err
.
args
[
0
]
==
EWOULDBLOCK
:
return
raise
sockobj
=
socket
(
_sock
=
client_socket
)
if
PYPY
:
client_socket
.
_drop
()
return
sockobj
,
address
def
do_close
(
self
,
socket
,
*
args
):
socket
.
close
()
...
...
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