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
a261cbc2
Commit
a261cbc2
authored
Jul 18, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
socket.py: in the implementation, use self.timeout instead of self.gettimeout()
parent
b6d41b3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
gevent/socket.py
gevent/socket.py
+13
-13
No files found.
gevent/socket.py
View file @
a261cbc2
...
...
@@ -123,7 +123,7 @@ class GreenSocket(object):
if
res
is
not
None
:
client
,
addr
=
res
return
type
(
self
)(
client
),
addr
wait_reader
(
fd
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
fd
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
def
close
(
self
):
self
.
fd
=
_closedsocket
()
...
...
@@ -135,11 +135,11 @@ class GreenSocket(object):
if
self
.
timeout
==
0.0
:
return
self
.
fd
.
connect
(
address
)
fd
=
self
.
fd
if
self
.
gettimeout
()
is
None
:
if
self
.
timeout
is
None
:
while
not
socket_connect
(
fd
,
address
):
wait_writer
(
fd
.
fileno
(),
timeout_exc
=
timeout
)
else
:
end
=
time
.
time
()
+
self
.
gettimeout
()
end
=
time
.
time
()
+
self
.
timeout
while
True
:
if
socket_connect
(
fd
,
address
):
return
...
...
@@ -151,14 +151,14 @@ class GreenSocket(object):
if
self
.
timeout
==
0.0
:
return
self
.
fd
.
connect_ex
(
address
)
fd
=
self
.
fd
if
self
.
gettimeout
()
is
None
:
if
self
.
timeout
is
None
:
while
not
socket_connect
(
fd
,
address
):
try
:
wait_writer
(
fd
.
fileno
(),
timeout_exc
=
timeout
)
except
error
,
ex
:
return
ex
[
0
]
else
:
end
=
time
.
time
()
+
self
.
gettimeout
()
end
=
time
.
time
()
+
self
.
timeout
while
True
:
if
socket_connect
(
fd
,
address
):
return
0
...
...
@@ -180,28 +180,28 @@ class GreenSocket(object):
def
recv
(
self
,
*
args
):
if
self
.
timeout
!=
0.0
:
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
res
=
self
.
fd
.
recv
(
*
args
)
return
res
def
recvfrom
(
self
,
*
args
):
if
self
.
timeout
!=
0.0
:
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
return
self
.
fd
.
recvfrom
(
*
args
)
def
recvfrom_into
(
self
,
*
args
):
if
self
.
timeout
!=
0.0
:
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
return
self
.
fd
.
recvfrom_into
(
*
args
)
def
recv_into
(
self
,
*
args
):
if
self
.
timeout
!=
0.0
:
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
return
self
.
fd
.
recv_into
(
*
args
)
def
send
(
self
,
*
args
):
if
self
.
timeout
!=
0.0
:
wait_writer
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_writer
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
return
self
.
fd
.
send
(
*
args
)
def
sendall
(
self
,
data
):
...
...
@@ -263,7 +263,7 @@ class GreenSSL(GreenSocket):
accepted
=
type
(
self
)(
client
)
accepted
.
do_handshake
()
# XXX
return
accepted
,
addr
wait_reader
(
fd
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
fd
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
def
do_handshake
(
self
):
while
True
:
...
...
@@ -284,7 +284,7 @@ class GreenSSL(GreenSocket):
def
send
(
self
,
data
):
if
self
.
timeout
!=
0.0
:
wait_writer
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_writer
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
try
:
return
self
.
fd
.
send
(
data
)
except
SSL
.
WantWriteError
:
...
...
@@ -302,7 +302,7 @@ class GreenSSL(GreenSocket):
if
pending
:
return
self
.
fd
.
recv
(
min
(
pending
,
buflen
))
if
self
.
timeout
!=
0.0
:
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
gettimeout
()
,
timeout_exc
=
timeout
)
wait_reader
(
self
.
fileno
(),
timeout
=
self
.
timeout
,
timeout_exc
=
timeout
)
try
:
return
self
.
fd
.
recv
(
buflen
)
except
SSL
.
ZeroReturnError
:
...
...
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