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
23e40c75
Commit
23e40c75
authored
Dec 06, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #217: do not set SO_REUSEADDR on Windows
parent
167d9372
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
gevent/server.py
gevent/server.py
+9
-2
greentest/test__server.py
greentest/test__server.py
+0
-1
No files found.
gevent/server.py
View file @
23e40c75
...
...
@@ -9,6 +9,13 @@ from gevent.socket import EWOULDBLOCK, socket
__all__
=
[
'StreamServer'
,
'DatagramServer'
]
if
sys
.
platform
==
'win32'
:
# SO_REUSEADDR on Windows does not mean the same thing as on *nix (issue #217)
DEFAULT_REUSE_ADDR
=
None
else
:
DEFAULT_REUSE_ADDR
=
1
class
StreamServer
(
BaseServer
):
"""A generic TCP server. Accepts connections on a listening socket and spawns user-provided *handle*
for each connection with 2 arguments: the client socket and the client address.
...
...
@@ -35,7 +42,7 @@ class StreamServer(BaseServer):
# the default backlog to use if none was provided in __init__
backlog
=
256
reuse_addr
=
1
reuse_addr
=
DEFAULT_REUSE_ADDR
def
__init__
(
self
,
listener
,
handle
=
None
,
backlog
=
None
,
spawn
=
'default'
,
**
ssl_args
):
BaseServer
.
__init__
(
self
,
listener
,
handle
=
handle
,
spawn
=
spawn
)
...
...
@@ -99,7 +106,7 @@ class StreamServer(BaseServer):
class
DatagramServer
(
BaseServer
):
"""A UDP server"""
reuse_addr
=
1
reuse_addr
=
DEFAULT_REUSE_ADDR
def
__init__
(
self
,
*
args
,
**
kwargs
):
BaseServer
.
__init__
(
self
,
*
args
,
**
kwargs
)
...
...
greentest/test__server.py
View file @
23e40c75
...
...
@@ -212,7 +212,6 @@ class TestDefaultSpawn(TestCase):
self
.
server
=
self
.
ServerSubClass
(
self
.
get_listener
())
# the connection won't be refused, because there exists a listening socket, but it won't be handled also
self
.
assertNotAccepted
()
self
.
server
.
reuse_addr
=
1
self
.
_test_server_start_stop
(
restartable
=
True
)
def
test_subclass_with_address
(
self
):
...
...
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