Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
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
shrapnel
Commits
21bcdfbf
Commit
21bcdfbf
authored
Oct 25, 2013
by
Sam Rushing
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #47 from sgalaburda/fix-create-connection
Fixed create_connection() to match the emulated one.
parents
f9c12264
f523cf87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
coro/emulation/socket.py
coro/emulation/socket.py
+6
-4
No files found.
coro/emulation/socket.py
View file @
21bcdfbf
# Copyright (c) 2002-2011 IronPort Systems and Cisco Systems
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
...
...
@@ -262,7 +262,7 @@ SocketType = socket
_GLOBAL_DEFAULT_TIMEOUT
=
object
()
def
create_connection
(
address
,
timeout
=
_GLOBAL_DEFAULT_TIMEOUT
):
def
create_connection
(
address
,
timeout
=
_GLOBAL_DEFAULT_TIMEOUT
,
source_address
=
None
):
# This is copied directly from Python's implementation.
msg
=
"getaddrinfo returns an empty list"
host
,
port
=
address
...
...
@@ -273,6 +273,8 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT):
sock
=
socket
(
af
,
socktype
,
proto
)
if
timeout
is
not
_GLOBAL_DEFAULT_TIMEOUT
:
sock
.
settimeout
(
timeout
)
if
source_address
:
sock
.
bind
(
source_address
)
sock
.
connect
(
sa
)
return
sock
...
...
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