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
1184b2fd
Commit
1184b2fd
authored
Apr 10, 2010
by
Ralf Schmitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use buffer object in order to prevent string copies
parent
a6a68374
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
gevent/socket.py
gevent/socket.py
+6
-3
No files found.
gevent/socket.py
View file @
1184b2fd
...
...
@@ -327,7 +327,9 @@ class socket(object):
def
recv
(
self
,
*
args
):
while
True
:
try
:
return
self
.
_sock
.
recv
(
*
args
)
res
=
self
.
_sock
.
recv
(
*
args
)
#print 'received: %r' % (res, )
return
res
except
error
,
ex
:
if
ex
[
0
]
!=
EWOULDBLOCK
or
self
.
timeout
==
0.0
:
raise
...
...
@@ -366,6 +368,7 @@ class socket(object):
wait_read
(
self
.
_sock
.
fileno
(),
timeout
=
self
.
timeout
)
def
send
(
self
,
data
,
flags
=
0
,
timeout
=
timeout_default
):
#print 'sending: %r' % data
if
timeout
is
timeout_default
:
timeout
=
self
.
timeout
try
:
...
...
@@ -388,13 +391,13 @@ class socket(object):
if
self
.
timeout
is
None
:
data_sent
=
0
while
data_sent
<
len
(
data
):
data_sent
+=
self
.
send
(
data
[
data_sent
:]
,
flags
)
data_sent
+=
self
.
send
(
buffer
(
data
,
data_sent
)
,
flags
)
else
:
timeleft
=
self
.
timeout
end
=
time
.
time
()
+
timeleft
data_sent
=
0
while
True
:
data_sent
+=
self
.
send
(
data
[
data_sent
:]
,
flags
,
timeout
=
timeleft
)
data_sent
+=
self
.
send
(
buffer
(
data
,
data_sent
)
,
flags
,
timeout
=
timeleft
)
if
data_sent
>=
len
(
data
):
break
timeleft
=
end
-
time
.
time
()
...
...
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